win32 compile and project fixes, made tool UI more clear

This commit is contained in:
Mikko Mononen 2010-08-17 18:30:58 +00:00
parent 785e9c68be
commit 5f7ac70cba
13 changed files with 79 additions and 24 deletions

Binary file not shown.

View File

@ -259,6 +259,10 @@
RelativePath="..\..\..\Detour\Include\DetourAlloc.h" RelativePath="..\..\..\Detour\Include\DetourAlloc.h"
> >
</File> </File>
<File
RelativePath="..\..\..\Detour\Include\DetourAssert.h"
>
</File>
<File <File
RelativePath="..\..\..\Detour\Include\DetourCommon.h" RelativePath="..\..\..\Detour\Include\DetourCommon.h"
> >
@ -271,6 +275,10 @@
RelativePath="..\..\..\Detour\Include\DetourNavMeshBuilder.h" RelativePath="..\..\..\Detour\Include\DetourNavMeshBuilder.h"
> >
</File> </File>
<File
RelativePath="..\..\..\Detour\Include\DetourNavMeshQuery.h"
>
</File>
<File <File
RelativePath="..\..\..\Detour\Include\DetourNode.h" RelativePath="..\..\..\Detour\Include\DetourNode.h"
> >
@ -295,6 +303,10 @@
RelativePath="..\..\..\Detour\Source\DetourNavMeshBuilder.cpp" RelativePath="..\..\..\Detour\Source\DetourNavMeshBuilder.cpp"
> >
</File> </File>
<File
RelativePath="..\..\..\Detour\Source\DetourNavMeshQuery.cpp"
>
</File>
<File <File
RelativePath="..\..\..\Detour\Source\DetourNode.cpp" RelativePath="..\..\..\Detour\Source\DetourNode.cpp"
> >
@ -315,6 +327,10 @@
RelativePath="..\..\Include\ConvexVolumeTool.h" RelativePath="..\..\Include\ConvexVolumeTool.h"
> >
</File> </File>
<File
RelativePath="..\..\Include\CrowdTool.h"
>
</File>
<File <File
RelativePath="..\..\Include\Filelist.h" RelativePath="..\..\Include\Filelist.h"
> >
@ -391,6 +407,10 @@
RelativePath="..\..\Source\ConvexVolumeTool.cpp" RelativePath="..\..\Source\ConvexVolumeTool.cpp"
> >
</File> </File>
<File
RelativePath="..\..\Source\CrowdTool.cpp"
>
</File>
<File <File
RelativePath="..\..\Source\Filelist.cpp" RelativePath="..\..\Source\Filelist.cpp"
> >

View File

@ -46,6 +46,7 @@ void imguiEndScrollArea();
void imguiIndent(); void imguiIndent();
void imguiUnindent(); void imguiUnindent();
void imguiSeparator(); void imguiSeparator();
void imguiSeparatorLine();
bool imguiButton(const char* text, bool enabled = true); bool imguiButton(const char* text, bool enabled = true);
bool imguiItem(const char* text, bool enabled = true); bool imguiItem(const char* text, bool enabled = true);

View File

@ -161,7 +161,7 @@ void ConvexVolumeTool::handleMenu()
imguiSeparator(); imguiSeparator();
} }
void ConvexVolumeTool::handleClick(const float* s, const float* p, bool shift) void ConvexVolumeTool::handleClick(const float* /*s*/, const float* p, bool shift)
{ {
if (!m_sample) return; if (!m_sample) return;
InputGeom* geom = m_sample->getInputGeom(); InputGeom* geom = m_sample->getInputGeom();
@ -234,7 +234,7 @@ void ConvexVolumeTool::handleStep()
{ {
} }
void ConvexVolumeTool::handleUpdate(const float dt) void ConvexVolumeTool::handleUpdate(const float /*dt*/)
{ {
} }

View File

@ -366,7 +366,7 @@ static void processSamples(Body* agent, const float vmax,
for (int i = 0; i < nobs; ++i) for (int i = 0; i < nobs; ++i)
{ {
const Body* ob = &obs[i]; const Body* ob = &obs[i];
float htmin, htmax; float htmin = 0, htmax = 0;
if (ob->type == BODY_CIRCLE) if (ob->type == BODY_CIRCLE)
{ {
@ -719,7 +719,7 @@ void CrowdManager::update(const float dt, unsigned int flags, dtNavMeshQuery* na
if (flags & CROWDMAN_DRUNK) if (flags & CROWDMAN_DRUNK)
{ {
ag->t += dt * (1.0f - ag->var*0.25f); ag->t += dt * (1.0f - ag->var*0.25f);
ag->maxspeed = MAX_SPEED*(1 + dtSqr(cosf(ag->t*2.0))*0.3f); ag->maxspeed = MAX_SPEED*(1 + dtSqr(cosf(ag->t*2.0f))*0.3f);
} }
else else
{ {

View File

@ -228,16 +228,25 @@ void NavMeshTesterTool::handleMenu()
m_toolMode = TOOLMODE_PATHFIND_SLICED; m_toolMode = TOOLMODE_PATHFIND_SLICED;
recalc(); recalc();
} }
imguiSeparator();
if (imguiCheck("Distance to Wall", m_toolMode == TOOLMODE_DISTANCE_TO_WALL)) if (imguiCheck("Distance to Wall", m_toolMode == TOOLMODE_DISTANCE_TO_WALL))
{ {
m_toolMode = TOOLMODE_DISTANCE_TO_WALL; m_toolMode = TOOLMODE_DISTANCE_TO_WALL;
recalc(); recalc();
} }
imguiSeparator();
if (imguiCheck("Raycast", m_toolMode == TOOLMODE_RAYCAST)) if (imguiCheck("Raycast", m_toolMode == TOOLMODE_RAYCAST))
{ {
m_toolMode = TOOLMODE_RAYCAST; m_toolMode = TOOLMODE_RAYCAST;
recalc(); recalc();
} }
imguiSeparator();
if (imguiCheck("Find Polys in Circle", m_toolMode == TOOLMODE_FIND_POLYS_IN_CIRCLE)) if (imguiCheck("Find Polys in Circle", m_toolMode == TOOLMODE_FIND_POLYS_IN_CIRCLE))
{ {
m_toolMode = TOOLMODE_FIND_POLYS_IN_CIRCLE; m_toolMode = TOOLMODE_FIND_POLYS_IN_CIRCLE;
@ -248,6 +257,9 @@ void NavMeshTesterTool::handleMenu()
m_toolMode = TOOLMODE_FIND_POLYS_IN_SHAPE; m_toolMode = TOOLMODE_FIND_POLYS_IN_SHAPE;
recalc(); recalc();
} }
imguiSeparator();
if (imguiCheck("Find Local Neighbourhood", m_toolMode == TOOLMODE_FIND_LOCAL_NEIGHBOURHOOD)) if (imguiCheck("Find Local Neighbourhood", m_toolMode == TOOLMODE_FIND_LOCAL_NEIGHBOURHOOD))
{ {
m_toolMode = TOOLMODE_FIND_LOCAL_NEIGHBOURHOOD; m_toolMode = TOOLMODE_FIND_LOCAL_NEIGHBOURHOOD;
@ -325,7 +337,7 @@ void NavMeshTesterTool::handleMenu()
} }
} }
void NavMeshTesterTool::handleClick(const float* s, const float* p, bool shift) void NavMeshTesterTool::handleClick(const float* /*s*/, const float* p, bool shift)
{ {
if (shift) if (shift)
{ {
@ -487,7 +499,7 @@ void NavMeshTesterTool::handleStep()
} }
void NavMeshTesterTool::handleUpdate(const float dt) void NavMeshTesterTool::handleUpdate(const float /*dt*/)
{ {
if (m_pathFindState == DT_QUERY_RUNNING) if (m_pathFindState == DT_QUERY_RUNNING)
{ {

View File

@ -83,7 +83,7 @@ void OffMeshConnectionTool::handleMenu()
} }
} }
void OffMeshConnectionTool::handleClick(const float* s, const float* p, bool shift) void OffMeshConnectionTool::handleClick(const float* /*s*/, const float* p, bool shift)
{ {
if (!m_sample) return; if (!m_sample) return;
InputGeom* geom = m_sample->getInputGeom(); InputGeom* geom = m_sample->getInputGeom();
@ -136,7 +136,7 @@ void OffMeshConnectionTool::handleStep()
{ {
} }
void OffMeshConnectionTool::handleUpdate(const float dt) void OffMeshConnectionTool::handleUpdate(const float /*dt*/)
{ {
} }

View File

@ -117,10 +117,15 @@ void Sample_SoloMeshSimple::handleTools()
setTool(new CrowdTool); setTool(new CrowdTool);
} }
imguiSeparator(); imguiSeparatorLine();
imguiIndent();
if (m_tool) if (m_tool)
m_tool->handleMenu(); m_tool->handleMenu();
imguiUnindent();
} }
void Sample_SoloMeshSimple::handleDebugMode() void Sample_SoloMeshSimple::handleDebugMode()

View File

@ -89,7 +89,7 @@ public:
virtual void handleStep() {} virtual void handleStep() {}
virtual void handleUpdate(const float dt) {} virtual void handleUpdate(const float /*dt*/) {}
virtual void handleRender() virtual void handleRender()
{ {
@ -227,10 +227,14 @@ void Sample_SoloMeshTiled::handleTools()
setTool(new TileHighlightTool); setTool(new TileHighlightTool);
} }
imguiSeparator(); imguiSeparatorLine();
imguiIndent();
if (m_tool) if (m_tool)
m_tool->handleMenu(); m_tool->handleMenu();
imguiUnindent();
} }
void Sample_SoloMeshTiled::handleDebugMode() void Sample_SoloMeshTiled::handleDebugMode()

View File

@ -113,7 +113,7 @@ public:
imguiValue("Shift+LMB to remove a tile."); imguiValue("Shift+LMB to remove a tile.");
} }
virtual void handleClick(const float* s, const float* p, bool shift) virtual void handleClick(const float* /*s*/, const float* p, bool shift)
{ {
m_hitPosSet = true; m_hitPosSet = true;
rcVcopy(m_hitPos,p); rcVcopy(m_hitPos,p);
@ -128,7 +128,7 @@ public:
virtual void handleStep() {} virtual void handleStep() {}
virtual void handleUpdate(const float dt) {} virtual void handleUpdate(const float /*dt*/) {}
virtual void handleRender() virtual void handleRender()
{ {
@ -415,10 +415,14 @@ void Sample_TileMesh::handleTools()
setTool(new CrowdTool); setTool(new CrowdTool);
} }
imguiSeparator(); imguiSeparatorLine();
imguiIndent();
if (m_tool) if (m_tool)
m_tool->handleMenu(); m_tool->handleMenu();
imguiUnindent();
} }
void Sample_TileMesh::handleDebugMode() void Sample_TileMesh::handleDebugMode()

View File

@ -66,7 +66,6 @@ static void addGfxCmdScissor(int x, int y, int w, int h)
cmd.rect.h = (short)h; cmd.rect.h = (short)h;
} }
/*
static void addGfxCmdRect(int x, int y, int w, int h, unsigned int color) static void addGfxCmdRect(int x, int y, int w, int h, unsigned int color)
{ {
if (g_gfxCmdQueueSize >= GFXCMD_QUEUE_SIZE) if (g_gfxCmdQueueSize >= GFXCMD_QUEUE_SIZE)
@ -81,7 +80,6 @@ static void addGfxCmdRect(int x, int y, int w, int h, unsigned int color)
cmd.rect.h = (short)h; cmd.rect.h = (short)h;
cmd.rect.r = 0; cmd.rect.r = 0;
} }
*/
static void addGfxCmdRoundedRect(int x, int y, int w, int h, int r, unsigned int color) static void addGfxCmdRoundedRect(int x, int y, int w, int h, int r, unsigned int color)
{ {
@ -627,6 +625,17 @@ void imguiSeparator()
g_state.widgetY -= DEFAULT_SPACING*3; g_state.widgetY -= DEFAULT_SPACING*3;
} }
void imguiSeparatorLine()
{
int x = g_state.widgetX;
int y = g_state.widgetY - DEFAULT_SPACING*2;
int w = g_state.widgetW;
int h = 1;
g_state.widgetY -= DEFAULT_SPACING*4;
addGfxCmdRect(x, y, w, h, imguiRGBA(255,255,255,32));
}
void imguiDrawText(int x, int y, int align, const char* text, unsigned int color) void imguiDrawText(int x, int y, int align, const char* text, unsigned int color)
{ {
addGfxCmdText(x, y, align, text, color); addGfxCmdText(x, y, align, text, color);

View File

@ -131,10 +131,10 @@ static void drawRect(float x, float y, float w, float h, float fth, unsigned int
{ {
float verts[4*2] = float verts[4*2] =
{ {
x, y, x+0.5f, y+0.5f,
x+w, y, x+w-0.5f, y+0.5f,
x+w, y+h, x+w-0.5f, y+h-0.5f,
x, y+h, x+0.5f, y+h-0.5f,
}; };
drawPolygon(verts, 4, fth, col); drawPolygon(verts, 4, fth, col);
} }

View File

@ -79,7 +79,7 @@ int main(int /*argc*/, char** /*argv*/)
const SDL_VideoInfo* vi = SDL_GetVideoInfo(); const SDL_VideoInfo* vi = SDL_GetVideoInfo();
const bool presentationMode = false; bool presentationMode = false;
int width, height; int width, height;
SDL_Surface* screen = 0; SDL_Surface* screen = 0;
@ -882,7 +882,7 @@ int main(int /*argc*/, char** /*argv*/)
// Tools // Tools
if (!showTestCases && showTools && showMenu && geom && sample) if (!showTestCases && showTools && showMenu && geom && sample)
{ {
if (imguiBeginScrollArea("Tools", 10, height - 10 - 350, 200, 350, &toolsScroll)) if (imguiBeginScrollArea("Tools", 10, height - 10 - 350, 250, 350, &toolsScroll))
mouseOverMenu = true; mouseOverMenu = true;
sample->handleTools(); sample->handleTools();