mirror of
https://github.com/glfw/glfw.git
synced 2024-11-10 00:51:47 +00:00
Removed auto-polling.
This commit is contained in:
parent
9b443e5bfd
commit
06f1ed38e6
@ -475,9 +475,6 @@ int main( void )
|
|||||||
// Enable mouse cursor (only needed for fullscreen mode)
|
// Enable mouse cursor (only needed for fullscreen mode)
|
||||||
glfwEnable( GLFW_MOUSE_CURSOR );
|
glfwEnable( GLFW_MOUSE_CURSOR );
|
||||||
|
|
||||||
// Disable automatic event polling
|
|
||||||
glfwDisable( GLFW_AUTO_POLL_EVENTS );
|
|
||||||
|
|
||||||
// Set callback functions
|
// Set callback functions
|
||||||
glfwSetWindowSizeCallback( windowSizeFun );
|
glfwSetWindowSizeCallback( windowSizeFun );
|
||||||
glfwSetWindowRefreshCallback( windowRefreshFun );
|
glfwSetWindowRefreshCallback( windowRefreshFun );
|
||||||
|
@ -345,7 +345,6 @@ extern "C" {
|
|||||||
#define GLFW_STICKY_MOUSE_BUTTONS 0x00030003
|
#define GLFW_STICKY_MOUSE_BUTTONS 0x00030003
|
||||||
#define GLFW_SYSTEM_KEYS 0x00030004
|
#define GLFW_SYSTEM_KEYS 0x00030004
|
||||||
#define GLFW_KEY_REPEAT 0x00030005
|
#define GLFW_KEY_REPEAT 0x00030005
|
||||||
#define GLFW_AUTO_POLL_EVENTS 0x00030006
|
|
||||||
|
|
||||||
/* glfwGetJoystickParam tokens */
|
/* glfwGetJoystickParam tokens */
|
||||||
#define GLFW_PRESENT 0x00050001
|
#define GLFW_PRESENT 0x00050001
|
||||||
|
@ -149,7 +149,6 @@ struct _GLFWwin_struct {
|
|||||||
// User selected window settings
|
// User selected window settings
|
||||||
int fullscreen; // Fullscreen flag
|
int fullscreen; // Fullscreen flag
|
||||||
int mouseLock; // Mouse-lock flag
|
int mouseLock; // Mouse-lock flag
|
||||||
int autoPollEvents; // Auto polling flag
|
|
||||||
int sysKeysDisabled; // System keys disabled flag
|
int sysKeysDisabled; // System keys disabled flag
|
||||||
int windowNoResize; // Resize- and maximize gadgets disabled flag
|
int windowNoResize; // Resize- and maximize gadgets disabled flag
|
||||||
int refreshRate; // Vertical monitor refresh rate
|
int refreshRate; // Vertical monitor refresh rate
|
||||||
|
@ -81,7 +81,6 @@ struct _GLFWwin_struct {
|
|||||||
// User selected window settings
|
// User selected window settings
|
||||||
int fullscreen; // Fullscreen flag
|
int fullscreen; // Fullscreen flag
|
||||||
int mouseLock; // Mouse-lock flag
|
int mouseLock; // Mouse-lock flag
|
||||||
int autoPollEvents; // Auto polling flag
|
|
||||||
int sysKeysDisabled; // System keys disabled flag
|
int sysKeysDisabled; // System keys disabled flag
|
||||||
int windowNoResize; // Resize- and maximize gadgets disabled flag
|
int windowNoResize; // Resize- and maximize gadgets disabled flag
|
||||||
int refreshRate; // Vertical monitor refresh rate
|
int refreshRate; // Vertical monitor refresh rate
|
||||||
|
25
lib/enable.c
25
lib/enable.c
@ -197,25 +197,6 @@ static void disableKeyRepeat(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Enable automatic event polling
|
|
||||||
//========================================================================
|
|
||||||
|
|
||||||
static void enableAutoPollEvents(void)
|
|
||||||
{
|
|
||||||
_glfwWin.autoPollEvents = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Disable automatic event polling
|
|
||||||
//========================================================================
|
|
||||||
|
|
||||||
static void disableAutoPollEvents(void)
|
|
||||||
{
|
|
||||||
_glfwWin.autoPollEvents = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//************************************************************************
|
//************************************************************************
|
||||||
//**** GLFW user functions ****
|
//**** GLFW user functions ****
|
||||||
//************************************************************************
|
//************************************************************************
|
||||||
@ -246,9 +227,6 @@ GLFWAPI void glfwEnable(int token)
|
|||||||
case GLFW_KEY_REPEAT:
|
case GLFW_KEY_REPEAT:
|
||||||
enableKeyRepeat();
|
enableKeyRepeat();
|
||||||
break;
|
break;
|
||||||
case GLFW_AUTO_POLL_EVENTS:
|
|
||||||
enableAutoPollEvents();
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -281,9 +259,6 @@ GLFWAPI void glfwDisable(int token)
|
|||||||
case GLFW_KEY_REPEAT:
|
case GLFW_KEY_REPEAT:
|
||||||
disableKeyRepeat();
|
disableKeyRepeat();
|
||||||
break;
|
break;
|
||||||
case GLFW_AUTO_POLL_EVENTS:
|
|
||||||
disableAutoPollEvents();
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -293,7 +293,6 @@ struct _GLFWwin_struct {
|
|||||||
// User selected window settings
|
// User selected window settings
|
||||||
int fullscreen; // Fullscreen flag
|
int fullscreen; // Fullscreen flag
|
||||||
int mouseLock; // Mouse-lock flag
|
int mouseLock; // Mouse-lock flag
|
||||||
int autoPollEvents; // Auto polling flag
|
|
||||||
int sysKeysDisabled; // System keys disabled flag
|
int sysKeysDisabled; // System keys disabled flag
|
||||||
int windowNoResize; // Resize- and maximize gadgets disabled flag
|
int windowNoResize; // Resize- and maximize gadgets disabled flag
|
||||||
int refreshRate; // Vertical monitor refresh rate
|
int refreshRate; // Vertical monitor refresh rate
|
||||||
|
@ -473,7 +473,6 @@ GLFWAPI int glfwOpenWindow(int width, int height,
|
|||||||
_glfwWin.active = GL_TRUE;
|
_glfwWin.active = GL_TRUE;
|
||||||
_glfwWin.iconified = GL_FALSE;
|
_glfwWin.iconified = GL_FALSE;
|
||||||
_glfwWin.mouseLock = GL_FALSE;
|
_glfwWin.mouseLock = GL_FALSE;
|
||||||
_glfwWin.autoPollEvents = GL_TRUE;
|
|
||||||
_glfwClearInput();
|
_glfwClearInput();
|
||||||
|
|
||||||
// Unregister all callback functions
|
// Unregister all callback functions
|
||||||
@ -742,10 +741,6 @@ GLFWAPI void glfwSwapBuffers(void)
|
|||||||
// Update display-buffer
|
// Update display-buffer
|
||||||
if (_glfwWin.opened)
|
if (_glfwWin.opened)
|
||||||
_glfwPlatformSwapBuffers();
|
_glfwPlatformSwapBuffers();
|
||||||
|
|
||||||
// Check for window messages
|
|
||||||
if (_glfwWin.autoPollEvents)
|
|
||||||
glfwPollEvents();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -188,7 +188,6 @@ struct _GLFWwin_struct {
|
|||||||
// User selected window settings
|
// User selected window settings
|
||||||
int fullscreen; // Fullscreen flag
|
int fullscreen; // Fullscreen flag
|
||||||
int mouseLock; // Mouse-lock flag
|
int mouseLock; // Mouse-lock flag
|
||||||
int autoPollEvents; // Auto polling flag
|
|
||||||
int sysKeysDisabled; // System keys disabled flag
|
int sysKeysDisabled; // System keys disabled flag
|
||||||
int windowNoResize; // Resize- and maximize gadgets disabled flag
|
int windowNoResize; // Resize- and maximize gadgets disabled flag
|
||||||
int refreshRate; // Vertical monitor refresh rate
|
int refreshRate; // Vertical monitor refresh rate
|
||||||
|
@ -96,7 +96,6 @@ static GLboolean open_window(void)
|
|||||||
glfwGetMousePos(&x, &y);
|
glfwGetMousePos(&x, &y);
|
||||||
printf("Mouse position: %i %i\n", x, y);
|
printf("Mouse position: %i %i\n", x, y);
|
||||||
|
|
||||||
glfwDisable(GLFW_AUTO_POLL_EVENTS);
|
|
||||||
glfwSetWindowSizeCallback(window_size_callback);
|
glfwSetWindowSizeCallback(window_size_callback);
|
||||||
glfwSetMousePosCallback(mouse_position_callback);
|
glfwSetMousePosCallback(mouse_position_callback);
|
||||||
glfwSetKeyCallback(key_callback);
|
glfwSetKeyCallback(key_callback);
|
||||||
|
Loading…
Reference in New Issue
Block a user