mirror of https://github.com/axmolengine/axmol.git
Hide Cursor - Feature Request #8766
Added the ability to hide or show the cursor on desktop builds.
This commit is contained in:
parent
e836e98dc4
commit
395c14f07d
|
@ -140,7 +140,11 @@ public:
|
|||
debugging big resolution (e.g.new ipad) app on desktop.*/
|
||||
virtual void setFrameZoomFactor(float zoomFactor) {}
|
||||
virtual float getFrameZoomFactor() const { return 1.0; }
|
||||
|
||||
/**
|
||||
* Hide or Show the mouse cursor if there is one.
|
||||
*/
|
||||
virtual void setCursorVisible( bool isVisible ){ /* do nothing by default*/ }
|
||||
|
||||
/** Get retina factor */
|
||||
virtual int getRetinaFactor() const { return 1; }
|
||||
|
||||
|
|
|
@ -477,6 +477,17 @@ void GLViewImpl::setIMEKeyboardState(bool /*bOpen*/)
|
|||
|
||||
}
|
||||
|
||||
void GLViewImpl::setCursorVisible( bool isVisible )
|
||||
{
|
||||
if( _mainWindow == NULL )
|
||||
return;
|
||||
|
||||
if( isVisible )
|
||||
glfwSetInputMode(_mainWindow, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
|
||||
else
|
||||
glfwSetInputMode(_mainWindow, GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
|
||||
}
|
||||
|
||||
void GLViewImpl::setFrameZoomFactor(float zoomFactor)
|
||||
{
|
||||
CCASSERT(zoomFactor > 0.0f, "zoomFactor must be larger than 0");
|
||||
|
|
|
@ -89,7 +89,10 @@ public:
|
|||
* Set zoom factor for frame. This method is for debugging big resolution (e.g.new ipad) app on desktop.
|
||||
*/
|
||||
void setFrameZoomFactor(float zoomFactor);
|
||||
|
||||
/**
|
||||
* Hide or Show the mouse cursor if there is one.
|
||||
*/
|
||||
virtual void setCursorVisible( bool isVisible );
|
||||
/** Retina support is disabled by default
|
||||
* @note This method is only available on Mac.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue