GLFW library does have a feature for keyboard input for detecting hold button status but it doesn't support same feature for mouse event. I need to manually implement it. This is my approach
Basically, the approach is to hold the status in bool flag, in the above code, it is m_isRightHold. When the user clicks on mouse button, the flag is set to true and once it is released, the flag is set to false. The approach works but in while-loop, even one click, it causes the function to report that the button is hold (i.e. while loop is faster than human's reaction to release the button). How this issue is handled? Sleep function to slow down my code. Any suggestions? Is using an independent thread an overkill solution? I've tried it and it works (i.e. sleep around 1.5 second is reasonable for my hand).
isRightDown and isRightUp should just be returning the value of m_isRightHold.
The setting of the value should be done elsewhere (such as a handler for mouse actions.) The documentation for glfw suggests that it supports callback functions for mouse events.