improve usability of ExampleBrowser

store command-line arguments in bulletDemo.txt
save/load of configuration, save demo name instead of index
add setBackgroundColor as example (background_color_red) and
mouse move/wheel speed config (mouse_wheel_multiplier and mouse_move_multiplier)
(saved after changing the demo)
default btIDebugDraw colors can be changed
b3CommandLineArgs::GetCmdLineArgument returns bool, and b3CommandLineArgs::addArgs added
fix copy/paste
This commit is contained in:
erwincoumans
2015-08-04 18:24:30 -07:00
parent 9d7d5caa8b
commit b316f30040
14 changed files with 400 additions and 115 deletions

View File

@@ -42,6 +42,7 @@ struct CommonGraphicsApp
float m_mouseXpos;
float m_mouseYpos;
bool m_mouseInitialized;
float m_backgroundColorRGB[3];
CommonGraphicsApp()
:m_window(0),
@@ -57,6 +58,9 @@ struct CommonGraphicsApp
m_mouseYpos(0.f),
m_mouseInitialized(false)
{
m_backgroundColorRGB[0] = 0.9;
m_backgroundColorRGB[1] = 0.9;
m_backgroundColorRGB[2] = 1;
}
virtual ~CommonGraphicsApp()
{
@@ -64,7 +68,42 @@ struct CommonGraphicsApp
virtual void dumpNextFrameToPng(const char* pngFilename){}
virtual void dumpFramesToVideo(const char* mp4Filename){}
virtual void getBackgroundColor(float* red, float* green, float* blue) const
{
if (red)
*red = m_backgroundColorRGB[0];
if (green)
*green = m_backgroundColorRGB[1];
if (blue)
*blue = m_backgroundColorRGB[2];
}
virtual void setBackgroundColor(float red, float green, float blue)
{
m_backgroundColorRGB[0] = red;
m_backgroundColorRGB[1] = green;
m_backgroundColorRGB[2] = blue;
}
virtual void setMouseWheelMultiplier(float mult)
{
m_wheelMultiplier = mult;
}
virtual float getMouseWheelMultiplier() const
{
return m_wheelMultiplier;
}
virtual void setMouseMoveMultiplier(float mult)
{
m_mouseMoveMultiplier = mult;
}
virtual float getMouseMoveMultiplier() const
{
return m_mouseMoveMultiplier;
}
virtual void drawGrid(DrawGridData data=DrawGridData()) = 0;
virtual void setUpAxis(int axis) = 0;
virtual int getUpAxis() const = 0;