diff --git a/.gitignore b/.gitignore
index 905675e..2009762 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,4 +2,6 @@ bin/
build/
src/tags
*.swp
+msvc/.vs/
+msvc/x64/
diff --git a/msvc/hexgame.sln b/msvc/hexgame.sln
new file mode 100644
index 0000000..d2d010d
--- /dev/null
+++ b/msvc/hexgame.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.27428.2011
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hexgame", "hexgame.vcxproj", "{A20061AD-7985-4275-96C6-A25215941A26}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {A20061AD-7985-4275-96C6-A25215941A26}.Debug|x64.ActiveCfg = Debug|x64
+ {A20061AD-7985-4275-96C6-A25215941A26}.Debug|x64.Build.0 = Debug|x64
+ {A20061AD-7985-4275-96C6-A25215941A26}.Debug|x86.ActiveCfg = Debug|x64
+ {A20061AD-7985-4275-96C6-A25215941A26}.Debug|x86.Build.0 = Debug|x64
+ {A20061AD-7985-4275-96C6-A25215941A26}.Release|x64.ActiveCfg = Release|x64
+ {A20061AD-7985-4275-96C6-A25215941A26}.Release|x64.Build.0 = Release|x64
+ {A20061AD-7985-4275-96C6-A25215941A26}.Release|x86.ActiveCfg = Release|Win32
+ {A20061AD-7985-4275-96C6-A25215941A26}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {AD869B47-2A3C-42CD-9CD1-70B5B8106A66}
+ EndGlobalSection
+EndGlobal
diff --git a/msvc/hexgame.vcxproj b/msvc/hexgame.vcxproj
new file mode 100644
index 0000000..23e1857
--- /dev/null
+++ b/msvc/hexgame.vcxproj
@@ -0,0 +1,135 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 15.0
+ {A20061AD-7985-4275-96C6-A25215941A26}
+ Win32Proj
+ 10.0.16299.0
+
+
+
+ Application
+ true
+ v141
+
+
+ Application
+ false
+ v141
+
+
+ Application
+ true
+ v141
+
+
+ Application
+ false
+ v141
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+ true
+
+
+
+ WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)
+ MultiThreadedDebugDLL
+ Level3
+ ProgramDatabase
+ Disabled
+
+
+ MachineX86
+ true
+ Windows
+
+
+
+
+ WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)
+ MultiThreadedDLL
+ Level3
+ ProgramDatabase
+
+
+ MachineX86
+ true
+ Windows
+ true
+ true
+
+
+
+
+ D:\dev\lib\glm;D:\dev\projects\hexgame\ext\imgui\examples\libs\gl3w;D:\dev\projects\hexgame\ext\imgui;D:\dev\projects\hexgame\ext\aixlog\include;D:\dev\lib\SDL2-2.0.8\include;%(AdditionalIncludeDirectories)
+
+
+ D:\dev\lib\SDL2-2.0.8\lib\x64;%(AdditionalLibraryDirectories)
+ SDL2.lib;Opengl32.lib;%(AdditionalDependencies)
+
+
+
+
+ D:\dev\lib\glm;D:\dev\projects\hexgame\ext\imgui\examples\libs\gl3w;D:\dev\projects\hexgame\ext\imgui;D:\dev\projects\hexgame\ext\aixlog\include;D:\dev\lib\SDL2-2.0.8\include;%(AdditionalIncludeDirectories)
+
+
+ D:\dev\lib\SDL2-2.0.8\lib\x64;%(AdditionalLibraryDirectories)
+ SDL2.lib;Opengl32.lib;%(AdditionalDependencies)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/msvc/hexgame.vcxproj.filters b/msvc/hexgame.vcxproj.filters
new file mode 100644
index 0000000..4c78506
--- /dev/null
+++ b/msvc/hexgame.vcxproj.filters
@@ -0,0 +1,48 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;hm;inl;inc;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav
+
+
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+
\ No newline at end of file
diff --git a/msvc/hexgame.vcxproj.user b/msvc/hexgame.vcxproj.user
new file mode 100644
index 0000000..be25078
--- /dev/null
+++ b/msvc/hexgame.vcxproj.user
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/msvc/imgui.ini b/msvc/imgui.ini
new file mode 100644
index 0000000..3b8fc7a
--- /dev/null
+++ b/msvc/imgui.ini
@@ -0,0 +1,5 @@
+[Window][Debug##Default]
+Pos=13,4
+Size=370,374
+Collapsed=0
+
diff --git a/src/gooey.h b/src/gooey.h
index f371abe..d6fba1b 100644
--- a/src/gooey.h
+++ b/src/gooey.h
@@ -3,7 +3,7 @@
#define GOOEY_H
-#include
+#include
#include "imgui.h"
#include "examples/sdl_opengl3_example/imgui_impl_sdl_gl3.h"
diff --git a/src/hexgame.cpp b/src/hexgame.cpp
index 9f1f886..c4b4381 100644
--- a/src/hexgame.cpp
+++ b/src/hexgame.cpp
@@ -18,7 +18,7 @@
#include
#endif
-#include
+#include
#include "hexgame.h"
#include "hexlib.h"
@@ -168,7 +168,7 @@ updateHexLineDraw(int32 x, int32 y)
for (hex_info &h1 : *g_game_state->hex_array)
{
- for (uint i = 0; i < hexLine.size(); i++)
+ for (uint32 i = 0; i < hexLine.size(); i++)
{
Hex h2 = hexLine[i];
if (hex_equal(h1.hex, h2))
diff --git a/src/hexgame.h b/src/hexgame.h
index 81cbfb5..92a794d 100644
--- a/src/hexgame.h
+++ b/src/hexgame.h
@@ -5,7 +5,7 @@
#include
#include
-#include
+#include
#include "aixlog.hpp"
#include "hexlib.h"
diff --git a/src/renderer.h b/src/renderer.h
index 6ae4d33..d61e255 100644
--- a/src/renderer.h
+++ b/src/renderer.h
@@ -10,7 +10,7 @@
//#include
#include
-#include
+#include
#include
#include
@@ -235,16 +235,28 @@ createScene(std::vector* hexes)
int hex_count = (int) hexes->size();
// 6 triangles * 3 vertices per triangle * 3 floats per vertex = 54
int vbuf_len = hex_count * 6 * 3 * 3;
- GLfloat vbuf[vbuf_len];
+
+ // TODO: surely there's a way to use indexed drawing for line vertices eg) line_loop
+ // and still use one buffer for multiple shapes/paths gldrawarraysintanced?, gldrawelements?
+ // https://gamedev.stackexchange.com/questions/104310/opengl-4-5-primitive-restart-vs-base-index
+ int line_vertices_per_hex = 6 * 2; // 12 vertices since we're using line segments atm
+ //gl_buffer *line_vertex_buffer = &g_hex_line_render_group.vertex_buffer;
+ int line_buf_len = hexes->size() * line_vertices_per_hex * 3; // 3 floats per vertex
+
+ // temporary buffers
+ GLfloat* vbuf = (GLfloat*) std::calloc(vbuf_len, sizeof(GLfloat));
+ GLfloat* cbuf = (GLfloat*) std::calloc(vbuf_len, sizeof(GLfloat));
+ GLfloat* line_buf = (GLfloat*) std::calloc(vbuf_len, sizeof(GLfloat));
+
for (int i = 0; i < hex_count; i++)
fillTriangleBufferFromHex(vbuf, 54 * i, (*hexes)[i]);
+
if (!initGLBufferObject(&g_filled_hex_render_group.vertex_buffer, vbuf_len, GL_DYNAMIC_DRAW, vbuf))
return false;
// color data for hex vertices
- GLfloat cbuf[vbuf_len];
fillColorBuffer(cbuf, vbuf_len, hexes);
if (!initGLBufferObject(&g_filled_hex_render_group.color_buffer, vbuf_len, GL_DYNAMIC_DRAW, cbuf))
@@ -252,17 +264,15 @@ createScene(std::vector* hexes)
// hex line vertex data
- // TODO: surely there's a way to use indexed drawing for line vertices eg) line_loop
- // and still use one buffer for multiple shapes/paths gldrawarraysintanced?, gldrawelements?
- // https://gamedev.stackexchange.com/questions/104310/opengl-4-5-primitive-restart-vs-base-index
- int line_vertices_per_hex = 6 * 2; // 12 vertices since we're using line segments atm
- //gl_buffer *line_vertex_buffer = &g_hex_line_render_group.vertex_buffer;
- int line_buf_len = hexes->size() * line_vertices_per_hex * 3; // 3 floats per vertex
- GLfloat line_buf[line_buf_len];
fillHexLineBuffer(line_buf, line_buf_len, hexes);
if (!initGLBufferObject(&g_hex_line_render_group.vertex_buffer, line_buf_len, GL_STATIC_DRAW, line_buf))
return false;
+ // free temporary buffers
+ std::free(vbuf);
+ std::free(cbuf);
+ std::free(line_buf);
+
// debug draw vertexes
// 4 vertices, 3 floats per vertex