Added confusion for code completion systems like VC++.

This commit is contained in:
Camilla Berglund 2011-02-09 12:37:42 +01:00
parent f02dbd30be
commit a66a4cd1e4
3 changed files with 46 additions and 16 deletions

View File

@ -449,7 +449,7 @@ extern "C" {
*************************************************************************/ *************************************************************************/
/* Window handle type */ /* Window handle type */
typedef struct _GLFWwindow* GLFWwindow; typedef void* GLFWwindow;
/* The video mode structure used by glfwGetVideoModes */ /* The video mode structure used by glfwGetVideoModes */
typedef struct typedef struct

View File

@ -39,7 +39,7 @@
// Returns the state of the specified key for the specified window // Returns the state of the specified key for the specified window
//======================================================================== //========================================================================
GLFWAPI int glfwGetKey(GLFWwindow window, int key) GLFWAPI int glfwGetKey(GLFWwindow handle, int key)
{ {
if (!_glfwInitialized) if (!_glfwInitialized)
{ {
@ -47,6 +47,8 @@ GLFWAPI int glfwGetKey(GLFWwindow window, int key)
return GLFW_RELEASE; return GLFW_RELEASE;
} }
_GLFWwindow* window = (_GLFWwindow*) handle;
// Is it a valid key? // Is it a valid key?
if (key < 0 || key > GLFW_KEY_LAST) if (key < 0 || key > GLFW_KEY_LAST)
{ {
@ -70,7 +72,7 @@ GLFWAPI int glfwGetKey(GLFWwindow window, int key)
// Returns the state of the specified mouse button for the specified window // Returns the state of the specified mouse button for the specified window
//======================================================================== //========================================================================
GLFWAPI int glfwGetMouseButton(GLFWwindow window, int button) GLFWAPI int glfwGetMouseButton(GLFWwindow handle, int button)
{ {
if (!_glfwInitialized) if (!_glfwInitialized)
{ {
@ -78,6 +80,8 @@ GLFWAPI int glfwGetMouseButton(GLFWwindow window, int button)
return GLFW_RELEASE; return GLFW_RELEASE;
} }
_GLFWwindow* window = (_GLFWwindow*) handle;
// Is it a valid mouse button? // Is it a valid mouse button?
if (button < 0 || button > GLFW_MOUSE_BUTTON_LAST) if (button < 0 || button > GLFW_MOUSE_BUTTON_LAST)
{ {
@ -100,7 +104,7 @@ GLFWAPI int glfwGetMouseButton(GLFWwindow window, int button)
// Returns the last reported cursor position for the specified window // Returns the last reported cursor position for the specified window
//======================================================================== //========================================================================
GLFWAPI void glfwGetMousePos(GLFWwindow window, int* xpos, int* ypos) GLFWAPI void glfwGetMousePos(GLFWwindow handle, int* xpos, int* ypos)
{ {
if (!_glfwInitialized) if (!_glfwInitialized)
{ {
@ -108,6 +112,8 @@ GLFWAPI void glfwGetMousePos(GLFWwindow window, int* xpos, int* ypos)
return; return;
} }
_GLFWwindow* window = (_GLFWwindow*) handle;
// Return mouse position // Return mouse position
if (xpos != NULL) if (xpos != NULL)
*xpos = window->mousePosX; *xpos = window->mousePosX;
@ -122,7 +128,7 @@ GLFWAPI void glfwGetMousePos(GLFWwindow window, int* xpos, int* ypos)
// the specified window // the specified window
//======================================================================== //========================================================================
GLFWAPI void glfwSetMousePos(GLFWwindow window, int xpos, int ypos) GLFWAPI void glfwSetMousePos(GLFWwindow handle, int xpos, int ypos)
{ {
if (!_glfwInitialized) if (!_glfwInitialized)
{ {
@ -130,6 +136,8 @@ GLFWAPI void glfwSetMousePos(GLFWwindow window, int xpos, int ypos)
return; return;
} }
_GLFWwindow* window = (_GLFWwindow*) handle;
// Don't do anything if the mouse position did not change // Don't do anything if the mouse position did not change
if (xpos == window->mousePosX && ypos == window->mousePosY) if (xpos == window->mousePosX && ypos == window->mousePosY)
return; return;
@ -151,7 +159,7 @@ GLFWAPI void glfwSetMousePos(GLFWwindow window, int xpos, int ypos)
// Returns the scroll offset for the specified window // Returns the scroll offset for the specified window
//======================================================================== //========================================================================
GLFWAPI void glfwGetScrollOffset(GLFWwindow window, int* x, int* y) GLFWAPI void glfwGetScrollOffset(GLFWwindow handle, int* x, int* y)
{ {
if (!_glfwInitialized) if (!_glfwInitialized)
{ {
@ -159,6 +167,8 @@ GLFWAPI void glfwGetScrollOffset(GLFWwindow window, int* x, int* y)
return; return;
} }
_GLFWwindow* window = (_GLFWwindow*) handle;
if (x) if (x)
*x = window->scrollX; *x = window->scrollX;

View File

@ -775,7 +775,7 @@ GLFWAPI void glfwOpenWindowHint(int target, int hint)
// Properly kill the window / video display // Properly kill the window / video display
//======================================================================== //========================================================================
GLFWAPI void glfwCloseWindow(GLFWwindow window) GLFWAPI void glfwCloseWindow(GLFWwindow handle)
{ {
if (!_glfwInitialized) if (!_glfwInitialized)
{ {
@ -783,6 +783,8 @@ GLFWAPI void glfwCloseWindow(GLFWwindow window)
return; return;
} }
_GLFWwindow* window = (_GLFWwindow*) handle;
// Show mouse pointer again (if hidden) // Show mouse pointer again (if hidden)
if (window == _glfwLibrary.cursorLockWindow) if (window == _glfwLibrary.cursorLockWindow)
glfwEnable(window, GLFW_MOUSE_CURSOR); glfwEnable(window, GLFW_MOUSE_CURSOR);
@ -831,7 +833,7 @@ GLFWAPI void glfwSetWindowTitle(GLFWwindow window, const char* title)
// Get the window size // Get the window size
//======================================================================== //========================================================================
GLFWAPI void glfwGetWindowSize(GLFWwindow window, int* width, int* height) GLFWAPI void glfwGetWindowSize(GLFWwindow handle, int* width, int* height)
{ {
if (!_glfwInitialized) if (!_glfwInitialized)
{ {
@ -839,6 +841,8 @@ GLFWAPI void glfwGetWindowSize(GLFWwindow window, int* width, int* height)
return; return;
} }
_GLFWwindow* window = (_GLFWwindow*) handle;
if (width != NULL) if (width != NULL)
*width = window->width; *width = window->width;
@ -851,7 +855,7 @@ GLFWAPI void glfwGetWindowSize(GLFWwindow window, int* width, int* height)
// Set the window size // Set the window size
//======================================================================== //========================================================================
GLFWAPI void glfwSetWindowSize(GLFWwindow window, int width, int height) GLFWAPI void glfwSetWindowSize(GLFWwindow handle, int width, int height)
{ {
if (!_glfwInitialized) if (!_glfwInitialized)
{ {
@ -859,6 +863,8 @@ GLFWAPI void glfwSetWindowSize(GLFWwindow window, int width, int height)
return; return;
} }
_GLFWwindow* window = (_GLFWwindow*) handle;
if (window->iconified) if (window->iconified)
{ {
// TODO: Figure out if this is an error // TODO: Figure out if this is an error
@ -884,7 +890,7 @@ GLFWAPI void glfwSetWindowSize(GLFWwindow window, int width, int height)
// Get the window position // Get the window position
//======================================================================== //========================================================================
GLFWAPI void glfwGetWindowPos(GLFWwindow window, int* x, int* y) GLFWAPI void glfwGetWindowPos(GLFWwindow handle, int* x, int* y)
{ {
if (!_glfwInitialized) if (!_glfwInitialized)
{ {
@ -892,6 +898,8 @@ GLFWAPI void glfwGetWindowPos(GLFWwindow window, int* x, int* y)
return; return;
} }
_GLFWwindow* window = (_GLFWwindow*) handle;
if (x != NULL) if (x != NULL)
*x = window->positionX; *x = window->positionX;
@ -904,7 +912,7 @@ GLFWAPI void glfwGetWindowPos(GLFWwindow window, int* x, int* y)
// Set the window position // Set the window position
//======================================================================== //========================================================================
GLFWAPI void glfwSetWindowPos(GLFWwindow window, int x, int y) GLFWAPI void glfwSetWindowPos(GLFWwindow handle, int x, int y)
{ {
if (!_glfwInitialized) if (!_glfwInitialized)
{ {
@ -912,6 +920,8 @@ GLFWAPI void glfwSetWindowPos(GLFWwindow window, int x, int y)
return; return;
} }
_GLFWwindow* window = (_GLFWwindow*) handle;
if (window->mode == GLFW_FULLSCREEN || window->iconified) if (window->mode == GLFW_FULLSCREEN || window->iconified)
{ {
// TODO: Figure out if this is an error // TODO: Figure out if this is an error
@ -926,7 +936,7 @@ GLFWAPI void glfwSetWindowPos(GLFWwindow window, int x, int y)
// Window iconification // Window iconification
//======================================================================== //========================================================================
GLFWAPI void glfwIconifyWindow(GLFWwindow window) GLFWAPI void glfwIconifyWindow(GLFWwindow handle)
{ {
if (!_glfwInitialized) if (!_glfwInitialized)
{ {
@ -934,6 +944,8 @@ GLFWAPI void glfwIconifyWindow(GLFWwindow window)
return; return;
} }
_GLFWwindow* window = (_GLFWwindow*) handle;
if (window->iconified) if (window->iconified)
return; return;
@ -945,7 +957,7 @@ GLFWAPI void glfwIconifyWindow(GLFWwindow window)
// Window un-iconification // Window un-iconification
//======================================================================== //========================================================================
GLFWAPI void glfwRestoreWindow(GLFWwindow window) GLFWAPI void glfwRestoreWindow(GLFWwindow handle)
{ {
if (!_glfwInitialized) if (!_glfwInitialized)
{ {
@ -953,6 +965,8 @@ GLFWAPI void glfwRestoreWindow(GLFWwindow window)
return; return;
} }
_GLFWwindow* window = (_GLFWwindow*) handle;
if (!window->iconified) if (!window->iconified)
return; return;
@ -1013,7 +1027,7 @@ GLFWAPI void glfwSwapInterval(int interval)
// Get window parameter // Get window parameter
//======================================================================== //========================================================================
GLFWAPI int glfwGetWindowParam(GLFWwindow window, int param) GLFWAPI int glfwGetWindowParam(GLFWwindow handle, int param)
{ {
if (!_glfwInitialized) if (!_glfwInitialized)
{ {
@ -1021,6 +1035,8 @@ GLFWAPI int glfwGetWindowParam(GLFWwindow window, int param)
return 0; return 0;
} }
_GLFWwindow* window = (_GLFWwindow*) handle;
switch (param) switch (param)
{ {
case GLFW_ACTIVE: case GLFW_ACTIVE:
@ -1080,7 +1096,7 @@ GLFWAPI int glfwGetWindowParam(GLFWwindow window, int param)
// Set the user pointer for the specified window // Set the user pointer for the specified window
//======================================================================== //========================================================================
GLFWAPI void glfwSetWindowUserPointer(GLFWwindow window, void* pointer) GLFWAPI void glfwSetWindowUserPointer(GLFWwindow handle, void* pointer)
{ {
if (!_glfwInitialized) if (!_glfwInitialized)
{ {
@ -1088,6 +1104,8 @@ GLFWAPI void glfwSetWindowUserPointer(GLFWwindow window, void* pointer)
return; return;
} }
_GLFWwindow* window = (_GLFWwindow*) handle;
window->userPointer = pointer; window->userPointer = pointer;
} }
@ -1096,7 +1114,7 @@ GLFWAPI void glfwSetWindowUserPointer(GLFWwindow window, void* pointer)
// Get the user pointer for the specified window // Get the user pointer for the specified window
//======================================================================== //========================================================================
GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow window) GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow handle)
{ {
if (!_glfwInitialized) if (!_glfwInitialized)
{ {
@ -1104,6 +1122,8 @@ GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow window)
return NULL; return NULL;
} }
_GLFWwindow* window = (_GLFWwindow*) handle;
return window->userPointer; return window->userPointer;
} }