mirror of https://github.com/bkaradzic/bgfx
texturev: Added mouse wheel zoom.
This commit is contained in:
parent
54411a2b5d
commit
c8abb371c9
|
@ -229,7 +229,7 @@ struct View
|
|||
m_zoom = zoom;
|
||||
}
|
||||
|
||||
m_zoom = bx::fclamp(m_zoom, 0.001f, 10.0f);
|
||||
m_zoom = bx::fclamp(m_zoom, 0.01f, 10.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -769,6 +769,7 @@ int _main_(int _argc, char** _argv)
|
|||
{
|
||||
uint32_t fileIndex = 0;
|
||||
|
||||
entry::MouseState mouseStatePrev;
|
||||
entry::MouseState mouseState;
|
||||
while (!entry::processEvents(width, height, debug, reset, &mouseState) )
|
||||
{
|
||||
|
@ -784,6 +785,23 @@ int _main_(int _argc, char** _argv)
|
|||
|
||||
static bool help = false;
|
||||
|
||||
static bool mouseDelta = false;
|
||||
if (!mouseDelta)
|
||||
{
|
||||
mouseStatePrev = mouseState;
|
||||
mouseDelta = true;
|
||||
}
|
||||
|
||||
int32_t zoomDelta = mouseState.m_mz - mouseStatePrev.m_mz;
|
||||
if (zoomDelta != 0)
|
||||
{
|
||||
char exec[64];
|
||||
bx::snprintf(exec, BX_COUNTOF(exec), "view zoom %+f", -zoomDelta*0.1f);
|
||||
cmdExec(exec);
|
||||
}
|
||||
|
||||
mouseStatePrev = mouseState;
|
||||
|
||||
if (help == false
|
||||
&& help != view.m_help)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue