diff --git a/RecastDemo/Bin/Recast.exe b/RecastDemo/Bin/Recast.exe index 812d178..5b90d98 100644 Binary files a/RecastDemo/Bin/Recast.exe and b/RecastDemo/Bin/Recast.exe differ diff --git a/RecastDemo/Build/VC9/Recast.vcproj b/RecastDemo/Build/VC9/Recast.vcproj index 69dca40..5dcfae6 100644 --- a/RecastDemo/Build/VC9/Recast.vcproj +++ b/RecastDemo/Build/VC9/Recast.vcproj @@ -122,7 +122,7 @@ RuntimeLibrary="2" EnableFunctionLevelLinking="true" UsePrecompiledHeader="0" - WarningLevel="3" + WarningLevel="4" DebugInformationFormat="3" /> depthMask(false); diff --git a/RecastDemo/Source/Sample.cpp b/RecastDemo/Source/Sample.cpp index 453dcbc..b3c47a8 100644 --- a/RecastDemo/Source/Sample.cpp +++ b/RecastDemo/Source/Sample.cpp @@ -130,7 +130,7 @@ void Sample::handleRender() duDebugDrawBoxWire(&dd, bmin[0],bmin[1],bmin[2], bmax[0],bmax[1],bmax[2], duRGBA(255,255,255,128), 1.0f); } -void Sample::handleRenderOverlay(double* proj, double* model, int* view) +void Sample::handleRenderOverlay(double* /*proj*/, double* /*model*/, int* /*view*/) { } diff --git a/RecastDemo/Source/Sample_Debug.cpp b/RecastDemo/Source/Sample_Debug.cpp index f62ade2..8ad8a30 100644 --- a/RecastDemo/Source/Sample_Debug.cpp +++ b/RecastDemo/Source/Sample_Debug.cpp @@ -35,6 +35,7 @@ # define snprintf _snprintf #endif +/* static int loadBin(const char* path, unsigned char** data) { FILE* fp = fopen(path, "rb"); @@ -47,7 +48,7 @@ static int loadBin(const char* path, unsigned char** data) fclose(fp); return size; } - +*/ Sample_Debug::Sample_Debug() : m_chf(0), @@ -167,7 +168,7 @@ void Sample_Debug::handleRender() duDebugDrawRawContours(&dd, *m_cset); } -void Sample_Debug::handleRenderOverlay(double* proj, double* model, int* view) +void Sample_Debug::handleRenderOverlay(double* /*proj*/, double* /*model*/, int* /*view*/) { } diff --git a/RecastDemo/Source/Sample_SoloMeshTiled.cpp b/RecastDemo/Source/Sample_SoloMeshTiled.cpp index 50db532..6e4ee3d 100644 --- a/RecastDemo/Source/Sample_SoloMeshTiled.cpp +++ b/RecastDemo/Source/Sample_SoloMeshTiled.cpp @@ -78,7 +78,7 @@ public: imguiValue("Click LMB to highlight a tile."); } - virtual void handleClick(const float* p, bool shift) + virtual void handleClick(const float* p, bool /*shift*/) { m_hitPosSet = true; vcopy(m_hitPos,p); @@ -561,7 +561,7 @@ static void drawLabels(int x, int y, int w, int h, } static void drawGraph(const char* name, int x, int y, int w, int h, float sd, - const int* samples, int n, int nsamples, const char* unit) + const int* samples, int n, int /*nsamples*/, const char* unit) { char text[64]; int first, last, maxval; diff --git a/RecastDemo/Source/Sample_TileMesh.cpp b/RecastDemo/Source/Sample_TileMesh.cpp index d1f6ef0..2da118f 100644 --- a/RecastDemo/Source/Sample_TileMesh.cpp +++ b/RecastDemo/Source/Sample_TileMesh.cpp @@ -146,7 +146,7 @@ public: } } - virtual void handleRenderOverlay(double* proj, double* model, int* view) + virtual void handleRenderOverlay(double* /*proj*/, double* /*model*/, int* /*view*/) { } }; diff --git a/RecastDemo/Source/imgui.cpp b/RecastDemo/Source/imgui.cpp index 64aa7c7..fc9b98c 100644 --- a/RecastDemo/Source/imgui.cpp +++ b/RecastDemo/Source/imgui.cpp @@ -506,7 +506,7 @@ bool imguiCollapse(const char* text, bool checked, bool enabled) const int cx = x+BUTTON_HEIGHT/2-CHECK_SIZE/2; const int cy = y+BUTTON_HEIGHT/2-CHECK_SIZE/2; - bool over = inRect(x, y, w, h); + bool over = enabled && inRect(x, y, w, h); bool res = buttonLogic(id, over); if (checked) @@ -514,8 +514,11 @@ bool imguiCollapse(const char* text, bool checked, bool enabled) else addGfxCmdTriangle(cx, cy, CHECK_SIZE, CHECK_SIZE, 1, imguiRGBA(255,255,255,isActive(id)?255:200)); - addGfxCmdText(x+BUTTON_HEIGHT, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_LEFT, text, isHot(id) ? imguiRGBA(255,196,0,255) : imguiRGBA(255,255,255,200)); - + if (enabled) + addGfxCmdText(x+BUTTON_HEIGHT, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_LEFT, text, isHot(id) ? imguiRGBA(255,196,0,255) : imguiRGBA(255,255,255,200)); + else + addGfxCmdText(x+BUTTON_HEIGHT, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_LEFT, text, imguiRGBA(128,128,128,200)); + return res; } @@ -557,7 +560,7 @@ bool imguiSlider(const char* text, float* val, float vmin, float vmax, float vin if (u > 1) u = 1; int m = (int)(u * range); - bool over = inRect(x+m, y, SLIDER_MARKER_WIDTH, SLIDER_HEIGHT); + bool over = enabled && inRect(x+m, y, SLIDER_MARKER_WIDTH, SLIDER_HEIGHT); bool res = buttonLogic(id, over); bool valChanged = false; @@ -592,8 +595,16 @@ bool imguiSlider(const char* text, float* val, float vmin, float vmax, float vin char msg[128]; snprintf(msg, 128, fmt, *val); - addGfxCmdText(x+SLIDER_HEIGHT/2, y+SLIDER_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_LEFT, text, isHot(id) ? imguiRGBA(255,196,0,255) : imguiRGBA(255,255,255,200)); - addGfxCmdText(x+w-SLIDER_HEIGHT/2, y+SLIDER_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_RIGHT, msg, isHot(id) ? imguiRGBA(255,196,0,255) : imguiRGBA(255,255,255,200)); + if (enabled) + { + addGfxCmdText(x+SLIDER_HEIGHT/2, y+SLIDER_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_LEFT, text, isHot(id) ? imguiRGBA(255,196,0,255) : imguiRGBA(255,255,255,200)); + addGfxCmdText(x+w-SLIDER_HEIGHT/2, y+SLIDER_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_RIGHT, msg, isHot(id) ? imguiRGBA(255,196,0,255) : imguiRGBA(255,255,255,200)); + } + else + { + addGfxCmdText(x+SLIDER_HEIGHT/2, y+SLIDER_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_LEFT, text, imguiRGBA(128,128,128,200)); + addGfxCmdText(x+w-SLIDER_HEIGHT/2, y+SLIDER_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_RIGHT, msg, imguiRGBA(128,128,128,200)); + } return res || valChanged; } diff --git a/RecastDemo/Source/imguiRenderGL.cpp b/RecastDemo/Source/imguiRenderGL.cpp index b161138..3d42e36 100644 --- a/RecastDemo/Source/imguiRenderGL.cpp +++ b/RecastDemo/Source/imguiRenderGL.cpp @@ -21,11 +21,25 @@ #include "imgui.h" #include "SDL.h" #include "SDL_opengl.h" -#define STBTT_malloc(x,y) malloc(x) -#define STBTT_free(x,y) free(x) + +void imguifree(void* ptr, void* userptr); +void* imguimalloc(size_t size, void* userptr); + +#define STBTT_malloc(x,y) imguimalloc(x,y) +#define STBTT_free(x,y) imguifree(x,y) #define STB_TRUETYPE_IMPLEMENTATION #include "stb_truetype.h" +void imguifree(void* ptr, void* /*userptr*/) +{ + free(ptr); +} + +void* imguimalloc(size_t size, void* /*userptr*/) +{ + return malloc(size); +} + static const unsigned TEMP_COORD_COUNT = 100; static float g_tempCoords[TEMP_COORD_COUNT*2]; static float g_tempNormals[TEMP_COORD_COUNT*2]; diff --git a/RecastDemo/Source/main.cpp b/RecastDemo/Source/main.cpp index aecbc82..e33cf15 100644 --- a/RecastDemo/Source/main.cpp +++ b/RecastDemo/Source/main.cpp @@ -149,7 +149,7 @@ static SampleItem g_samples[] = static const int g_nsamples = sizeof(g_samples)/sizeof(SampleItem); -int main(int argc, char *argv[]) +int main(int /*argc*/, char** /*argv*/) { // Init SDL if (SDL_Init(SDL_INIT_EVERYTHING) != 0)