2010-09-07 17:34:51 +02:00
|
|
|
//========================================================================
|
2011-03-06 01:46:39 +01:00
|
|
|
// GLFW - An OpenGL library
|
2010-09-07 17:34:51 +02:00
|
|
|
// Platform: Any
|
2010-09-07 17:41:26 +02:00
|
|
|
// API version: 3.0
|
2010-09-07 17:34:51 +02:00
|
|
|
// WWW: http://www.glfw.org/
|
|
|
|
//------------------------------------------------------------------------
|
|
|
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
|
|
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
|
|
|
//
|
|
|
|
// This software is provided 'as-is', without any express or implied
|
|
|
|
// warranty. In no event will the authors be held liable for any damages
|
|
|
|
// arising from the use of this software.
|
|
|
|
//
|
|
|
|
// Permission is granted to anyone to use this software for any purpose,
|
|
|
|
// including commercial applications, and to alter it and redistribute it
|
|
|
|
// freely, subject to the following restrictions:
|
|
|
|
//
|
|
|
|
// 1. The origin of this software must not be misrepresented; you must not
|
|
|
|
// claim that you wrote the original software. If you use this software
|
|
|
|
// in a product, an acknowledgment in the product documentation would
|
|
|
|
// be appreciated but is not required.
|
|
|
|
//
|
|
|
|
// 2. Altered source versions must be plainly marked as such, and must not
|
|
|
|
// be misrepresented as being the original software.
|
|
|
|
//
|
|
|
|
// 3. This notice may not be removed or altered from any source
|
|
|
|
// distribution.
|
|
|
|
//
|
|
|
|
//========================================================================
|
|
|
|
|
|
|
|
#ifndef _internal_h_
|
|
|
|
#define _internal_h_
|
|
|
|
|
|
|
|
|
2013-01-15 22:43:44 +01:00
|
|
|
#include "config.h"
|
|
|
|
|
2013-01-16 06:38:17 +01:00
|
|
|
#if defined(_GLFW_USE_OPENGL)
|
|
|
|
// This is the default for glfw3.h
|
|
|
|
#elif defined(_GLFW_USE_GLESV1)
|
2013-01-15 22:43:44 +01:00
|
|
|
#define GLFW_INCLUDE_ES1
|
|
|
|
#elif defined(_GLFW_USE_GLESV2)
|
|
|
|
#define GLFW_INCLUDE_ES2
|
2013-01-16 06:38:17 +01:00
|
|
|
#else
|
|
|
|
#error "No supported client library selected"
|
2013-01-15 22:43:44 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// Disable the inclusion of the platform glext.h by gl.h to allow proper
|
|
|
|
// inclusion of our own, newer glext.h below
|
|
|
|
#define GL_GLEXT_LEGACY
|
|
|
|
|
|
|
|
#include "../include/GL/glfw3.h"
|
|
|
|
|
|
|
|
#if defined(_GLFW_USE_OPENGL)
|
|
|
|
// This path may need to be changed if you build GLFW using your own setup
|
|
|
|
// GLFW comes with its own copy of glext.h since it uses fairly new extensions
|
|
|
|
// and not all development environments come with an up-to-date version
|
|
|
|
#include "../support/GL/glext.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef struct _GLFWhints _GLFWhints;
|
|
|
|
typedef struct _GLFWwndconfig _GLFWwndconfig;
|
|
|
|
typedef struct _GLFWfbconfig _GLFWfbconfig;
|
|
|
|
typedef struct _GLFWwindow _GLFWwindow;
|
|
|
|
typedef struct _GLFWlibrary _GLFWlibrary;
|
|
|
|
typedef struct _GLFWmonitor _GLFWmonitor;
|
|
|
|
|
|
|
|
#if defined(_GLFW_COCOA)
|
|
|
|
#include "cocoa_platform.h"
|
|
|
|
#elif defined(_GLFW_WIN32)
|
|
|
|
#include "win32_platform.h"
|
|
|
|
#elif defined(_GLFW_X11)
|
|
|
|
#include "x11_platform.h"
|
|
|
|
#else
|
|
|
|
#error "No supported window creation API selected"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2013-01-02 02:21:38 +01:00
|
|
|
//========================================================================
|
|
|
|
// Doxygen group definitions
|
|
|
|
//========================================================================
|
|
|
|
|
|
|
|
/*! @defgroup platform Platform API
|
|
|
|
* @brief The API implemented by the platform-specific code.
|
|
|
|
*
|
|
|
|
* The platform API is the interface exposed by the platform-specific code for
|
|
|
|
* each platform and is called by the shared code of the public API It mirrors
|
|
|
|
* the public API except it uses objects instead of handles.
|
|
|
|
*/
|
|
|
|
/*! @defgroup event Event API
|
|
|
|
* @brief The API used by the platform-specific code to report events.
|
|
|
|
*
|
|
|
|
* The event API is used by the platform-specific code to notify the shared
|
|
|
|
* code of events that can be translated into state changes and/or callback
|
|
|
|
* calls.
|
|
|
|
*/
|
|
|
|
/*! @defgroup utility Utility functions
|
|
|
|
* @brief Various utility functions.
|
|
|
|
*
|
|
|
|
* These functions are shared code and may be used by any part of GLFW
|
|
|
|
* Each platform may add its own utility functions, but those may only be
|
|
|
|
* called by the platform-specific code
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2010-09-07 17:34:51 +02:00
|
|
|
//========================================================================
|
2013-01-15 22:43:44 +01:00
|
|
|
// Helper macros
|
2010-09-07 17:34:51 +02:00
|
|
|
//========================================================================
|
|
|
|
|
2013-01-15 22:43:44 +01:00
|
|
|
// Internal key state used for sticky keys
|
2013-01-15 22:44:50 +01:00
|
|
|
#define _GLFW_STICK 2
|
2010-09-07 17:34:51 +02:00
|
|
|
|
|
|
|
|
2012-04-22 21:49:38 +02:00
|
|
|
//========================================================================
|
2013-01-15 22:43:44 +01:00
|
|
|
// Internal types
|
2013-01-02 02:21:38 +01:00
|
|
|
//========================================================================
|
|
|
|
|
|
|
|
/*! @brief Window, framebuffer and context hints.
|
|
|
|
*
|
|
|
|
* It is used only by shared code and only to store parameters passed to us by
|
|
|
|
* @ref glfwWindowHint for use by @ref glfwCreateWindow.
|
|
|
|
*/
|
2010-10-04 18:17:53 +02:00
|
|
|
struct _GLFWhints
|
2010-09-09 20:18:10 +02:00
|
|
|
{
|
2010-09-09 19:58:51 +02:00
|
|
|
int redBits;
|
|
|
|
int greenBits;
|
|
|
|
int blueBits;
|
|
|
|
int alphaBits;
|
|
|
|
int depthBits;
|
|
|
|
int stencilBits;
|
2010-09-07 17:34:51 +02:00
|
|
|
int accumRedBits;
|
|
|
|
int accumGreenBits;
|
|
|
|
int accumBlueBits;
|
|
|
|
int accumAlphaBits;
|
|
|
|
int auxBuffers;
|
2010-10-25 12:36:14 +02:00
|
|
|
GLboolean stereo;
|
2011-11-02 16:56:34 +01:00
|
|
|
GLboolean resizable;
|
2012-08-21 21:18:09 +02:00
|
|
|
GLboolean visible;
|
2010-09-07 17:34:51 +02:00
|
|
|
int samples;
|
2012-12-02 16:10:00 +01:00
|
|
|
GLboolean sRGB;
|
2012-09-30 15:32:50 +02:00
|
|
|
int clientAPI;
|
2010-09-07 17:34:51 +02:00
|
|
|
int glMajor;
|
|
|
|
int glMinor;
|
2010-10-25 12:36:14 +02:00
|
|
|
GLboolean glForward;
|
|
|
|
GLboolean glDebug;
|
2010-09-07 17:34:51 +02:00
|
|
|
int glProfile;
|
2011-03-07 20:51:34 +01:00
|
|
|
int glRobustness;
|
2010-10-04 18:17:53 +02:00
|
|
|
};
|
2010-09-07 17:34:51 +02:00
|
|
|
|
|
|
|
|
2013-01-02 02:21:38 +01:00
|
|
|
/*! @brief Window and context configuration.
|
|
|
|
*
|
|
|
|
* Parameters relating to the creation of the context and window but not
|
|
|
|
* directly related to the framebuffer. This is used to pass window and
|
|
|
|
* context creation parameters from shared code to the platform API.
|
|
|
|
*/
|
2010-10-04 18:17:53 +02:00
|
|
|
struct _GLFWwndconfig
|
2010-09-09 20:18:10 +02:00
|
|
|
{
|
2012-11-25 14:53:33 +01:00
|
|
|
int width;
|
|
|
|
int height;
|
2010-10-04 18:17:53 +02:00
|
|
|
const char* title;
|
2011-11-02 16:56:34 +01:00
|
|
|
GLboolean resizable;
|
2012-08-21 21:18:09 +02:00
|
|
|
GLboolean visible;
|
2012-09-30 15:32:50 +02:00
|
|
|
int clientAPI;
|
2010-10-04 18:17:53 +02:00
|
|
|
int glMajor;
|
|
|
|
int glMinor;
|
2010-10-25 12:36:14 +02:00
|
|
|
GLboolean glForward;
|
|
|
|
GLboolean glDebug;
|
2010-10-04 18:17:53 +02:00
|
|
|
int glProfile;
|
2011-03-07 20:51:34 +01:00
|
|
|
int glRobustness;
|
2012-09-27 21:37:36 +02:00
|
|
|
_GLFWmonitor* monitor;
|
2010-10-04 18:17:53 +02:00
|
|
|
_GLFWwindow* share;
|
|
|
|
};
|
2010-09-07 17:34:51 +02:00
|
|
|
|
|
|
|
|
2013-01-02 02:21:38 +01:00
|
|
|
/*! @brief Framebuffer configuration.
|
|
|
|
*
|
2013-01-15 20:00:27 +01:00
|
|
|
* This describes buffers and their sizes. It is used to pass framebuffer
|
|
|
|
* parameters from shared code to the platform API.
|
2013-01-02 02:21:38 +01:00
|
|
|
*/
|
2010-10-04 18:17:53 +02:00
|
|
|
struct _GLFWfbconfig
|
2010-09-09 20:18:10 +02:00
|
|
|
{
|
2010-09-07 17:34:51 +02:00
|
|
|
int redBits;
|
|
|
|
int greenBits;
|
|
|
|
int blueBits;
|
|
|
|
int alphaBits;
|
|
|
|
int depthBits;
|
|
|
|
int stencilBits;
|
|
|
|
int accumRedBits;
|
|
|
|
int accumGreenBits;
|
|
|
|
int accumBlueBits;
|
|
|
|
int accumAlphaBits;
|
|
|
|
int auxBuffers;
|
2010-10-25 12:36:14 +02:00
|
|
|
GLboolean stereo;
|
2010-09-07 17:34:51 +02:00
|
|
|
int samples;
|
2012-12-02 16:10:00 +01:00
|
|
|
GLboolean sRGB;
|
2010-10-04 18:17:53 +02:00
|
|
|
};
|
2010-09-07 17:34:51 +02:00
|
|
|
|
|
|
|
|
2013-01-02 02:21:38 +01:00
|
|
|
/*! @brief Window and context structure.
|
|
|
|
*/
|
2010-10-04 18:17:53 +02:00
|
|
|
struct _GLFWwindow
|
2010-09-09 20:18:10 +02:00
|
|
|
{
|
2010-09-10 00:06:23 +02:00
|
|
|
struct _GLFWwindow* next;
|
|
|
|
|
2010-09-09 20:18:10 +02:00
|
|
|
// Window settings and state
|
2013-01-02 16:48:02 +01:00
|
|
|
GLboolean iconified;
|
|
|
|
GLboolean resizable;
|
|
|
|
GLboolean visible;
|
2013-01-17 20:31:16 +01:00
|
|
|
GLboolean closed;
|
2013-01-02 16:48:02 +01:00
|
|
|
void* userPointer;
|
2013-01-02 17:29:24 +01:00
|
|
|
GLFWvidmode videoMode;
|
2013-01-02 16:48:02 +01:00
|
|
|
_GLFWmonitor* monitor;
|
2010-09-09 18:15:32 +02:00
|
|
|
|
2010-09-09 20:18:10 +02:00
|
|
|
// Window input state
|
2013-01-02 16:48:02 +01:00
|
|
|
GLboolean stickyKeys;
|
|
|
|
GLboolean stickyMouseButtons;
|
|
|
|
int cursorPosX, cursorPosY;
|
|
|
|
int cursorMode;
|
|
|
|
char mouseButton[GLFW_MOUSE_BUTTON_LAST + 1];
|
|
|
|
char key[GLFW_KEY_LAST + 1];
|
2010-09-09 18:15:32 +02:00
|
|
|
|
|
|
|
// OpenGL extensions and context attributes
|
2013-01-02 16:48:02 +01:00
|
|
|
int clientAPI;
|
|
|
|
int glMajor, glMinor, glRevision;
|
|
|
|
GLboolean glForward, glDebug;
|
|
|
|
int glProfile;
|
|
|
|
int glRobustness;
|
2013-01-15 04:26:11 +01:00
|
|
|
#if defined(_GLFW_USE_OPENGL)
|
2010-09-09 18:15:32 +02:00
|
|
|
PFNGLGETSTRINGIPROC GetStringi;
|
2013-01-15 04:26:11 +01:00
|
|
|
#endif
|
2010-09-09 18:15:32 +02:00
|
|
|
|
2013-01-15 21:34:26 +01:00
|
|
|
struct {
|
|
|
|
GLFWwindowposfun pos;
|
|
|
|
GLFWwindowsizefun size;
|
|
|
|
GLFWwindowclosefun close;
|
|
|
|
GLFWwindowrefreshfun refresh;
|
|
|
|
GLFWwindowfocusfun focus;
|
|
|
|
GLFWwindowiconifyfun iconify;
|
|
|
|
GLFWmousebuttonfun mouseButton;
|
|
|
|
GLFWcursorposfun cursorPos;
|
|
|
|
GLFWcursorenterfun cursorEnter;
|
|
|
|
GLFWscrollfun scroll;
|
|
|
|
GLFWkeyfun key;
|
|
|
|
GLFWcharfun character;
|
|
|
|
} callbacks;
|
2012-10-28 13:45:11 +01:00
|
|
|
|
2013-01-02 02:21:38 +01:00
|
|
|
// This is defined in the window API's platform.h
|
2010-09-09 18:15:32 +02:00
|
|
|
_GLFW_PLATFORM_WINDOW_STATE;
|
2013-01-02 02:21:38 +01:00
|
|
|
// This is defined in the context API's platform.h
|
2010-09-09 20:36:23 +02:00
|
|
|
_GLFW_PLATFORM_CONTEXT_STATE;
|
2010-10-04 18:17:53 +02:00
|
|
|
};
|
2010-09-09 18:15:32 +02:00
|
|
|
|
|
|
|
|
2013-01-02 02:21:38 +01:00
|
|
|
/*! @brief Monitor structure.
|
|
|
|
*/
|
2011-10-03 09:24:35 +02:00
|
|
|
struct _GLFWmonitor
|
2011-05-07 10:53:50 +02:00
|
|
|
{
|
2013-01-02 16:48:02 +01:00
|
|
|
char* name;
|
2012-09-13 17:46:40 +02:00
|
|
|
|
2013-01-02 16:48:02 +01:00
|
|
|
GLboolean primary;
|
2012-09-13 17:46:40 +02:00
|
|
|
|
2013-01-02 16:48:02 +01:00
|
|
|
// Physical dimensions in millimeters.
|
|
|
|
int widthMM, heightMM;
|
|
|
|
// Logical orientation of the screen on the desktop
|
|
|
|
int positionX, positionY;
|
2011-10-02 22:13:47 +02:00
|
|
|
|
2013-01-02 16:48:02 +01:00
|
|
|
GLFWvidmode* modes;
|
|
|
|
int modeCount;
|
2012-08-03 02:57:33 +02:00
|
|
|
|
2013-01-02 02:21:38 +01:00
|
|
|
// This is defined in the window API's platform.h
|
2011-10-03 09:24:35 +02:00
|
|
|
_GLFW_PLATFORM_MONITOR_STATE;
|
2011-05-07 10:53:50 +02:00
|
|
|
};
|
|
|
|
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @brief Library global data.
|
|
|
|
*/
|
2010-10-04 18:17:53 +02:00
|
|
|
struct _GLFWlibrary
|
2010-09-09 20:18:10 +02:00
|
|
|
{
|
2013-01-02 16:48:02 +01:00
|
|
|
_GLFWhints hints;
|
2010-09-10 00:06:23 +02:00
|
|
|
|
2013-01-02 16:48:02 +01:00
|
|
|
_GLFWwindow* windowListHead;
|
|
|
|
_GLFWwindow* focusedWindow;
|
2012-09-12 19:35:52 +02:00
|
|
|
|
2013-01-02 16:48:02 +01:00
|
|
|
_GLFWmonitor** monitors;
|
|
|
|
int monitorCount;
|
|
|
|
GLFWmonitorfun monitorCallback;
|
2010-10-24 18:28:55 +02:00
|
|
|
|
2013-01-02 16:48:02 +01:00
|
|
|
GLFWgammaramp originalRamp;
|
|
|
|
int originalRampSize;
|
|
|
|
GLboolean rampChanged;
|
2010-09-09 18:15:32 +02:00
|
|
|
|
2013-01-02 02:21:38 +01:00
|
|
|
// This is defined in the window API's platform.h
|
2012-04-22 15:53:02 +02:00
|
|
|
_GLFW_PLATFORM_LIBRARY_WINDOW_STATE;
|
2013-01-02 02:21:38 +01:00
|
|
|
// This is defined in the context API's platform.h
|
2012-04-22 15:53:02 +02:00
|
|
|
_GLFW_PLATFORM_LIBRARY_OPENGL_STATE;
|
2010-10-04 18:17:53 +02:00
|
|
|
};
|
2010-09-09 18:15:32 +02:00
|
|
|
|
|
|
|
|
2013-01-02 02:21:38 +01:00
|
|
|
//========================================================================
|
2012-08-26 20:11:32 +02:00
|
|
|
// Global state shared between compilation units of GLFW
|
2013-01-02 02:21:38 +01:00
|
|
|
//========================================================================
|
|
|
|
|
|
|
|
/*! @brief Flag indicating whether GLFW has been successfully initialized.
|
|
|
|
*/
|
2012-08-26 18:42:15 +02:00
|
|
|
extern GLboolean _glfwInitialized;
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @brief All global data protected by @ref _glfwInitialized.
|
|
|
|
* This should only be touched after a call to @ref glfwInit that has not been
|
|
|
|
* followed by a call to @ref glfwTerminate.
|
|
|
|
*/
|
2013-01-02 01:40:42 +01:00
|
|
|
extern _GLFWlibrary _glfw;
|
2010-09-09 18:15:32 +02:00
|
|
|
|
2010-09-07 17:34:51 +02:00
|
|
|
|
|
|
|
//========================================================================
|
2013-01-02 02:21:38 +01:00
|
|
|
// Platform API functions
|
2010-09-07 17:34:51 +02:00
|
|
|
//========================================================================
|
|
|
|
|
2013-01-02 02:21:38 +01:00
|
|
|
/*! @brief Initializes the platform-specific part of the library.
|
|
|
|
* @return @c GL_TRUE if successful, or @c GL_FALSE if an error occurred.
|
|
|
|
* @ingroup platform
|
|
|
|
*/
|
2010-09-08 17:30:21 +02:00
|
|
|
int _glfwPlatformInit(void);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @brief Terminates the platform-specific part of the library.
|
|
|
|
* @ingroup platform
|
|
|
|
*/
|
2012-12-30 01:15:48 +01:00
|
|
|
void _glfwPlatformTerminate(void);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @brief Returns a string describing the compile-time configuration of the
|
|
|
|
* platform-specific part of the library.
|
|
|
|
* @return The version string.
|
|
|
|
* @ingroup platform
|
|
|
|
*
|
|
|
|
* The format of the string is as follows:
|
|
|
|
* @arg The name of the window system API used
|
|
|
|
* @arg The name of the context creation API used
|
|
|
|
* @arg Any additional options or APIs
|
|
|
|
*
|
|
|
|
* @note The returned string must be available for the duration of the program.
|
|
|
|
*
|
|
|
|
* @note The returned string must not change for the duration of the program.
|
|
|
|
*/
|
2010-09-13 18:05:59 +02:00
|
|
|
const char* _glfwPlatformGetVersionString(void);
|
2010-09-09 21:06:59 +02:00
|
|
|
|
2013-01-02 02:21:38 +01:00
|
|
|
/*! @brief Sets the position of the system cursor.
|
|
|
|
* @param[in] window The window whose client area the specified posiiton is
|
|
|
|
* relative to.
|
|
|
|
* @param[in] x The new x-coordinate of the cursor, relative to the left edge
|
|
|
|
* of the client area of the window.
|
|
|
|
* @param[in] y The new y-coordinate of the cursor, relative to the top edge
|
|
|
|
* of the client area of the window.
|
|
|
|
* @ingroup platform
|
|
|
|
*/
|
2012-06-22 13:53:02 +02:00
|
|
|
void _glfwPlatformSetCursorPos(_GLFWwindow* window, int x, int y);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @brief Sets up the specified cursor mode for the specified window.
|
|
|
|
* @param[in] window The window whose cursor mode to change.
|
|
|
|
* @param[in] mode The desired cursor mode.
|
|
|
|
* @ingroup platform
|
|
|
|
*/
|
2012-04-06 14:37:31 +02:00
|
|
|
void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode);
|
2010-09-07 17:34:51 +02:00
|
|
|
|
2013-01-02 02:21:38 +01:00
|
|
|
/*! @ingroup platform
|
|
|
|
*/
|
2012-09-12 19:35:52 +02:00
|
|
|
_GLFWmonitor** _glfwPlatformGetMonitors(int* count);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @ingroup platform
|
|
|
|
*/
|
2012-09-12 19:35:52 +02:00
|
|
|
void _glfwPlatformDestroyMonitor(_GLFWmonitor* monitor);
|
|
|
|
|
2013-01-02 02:21:38 +01:00
|
|
|
/*! @ingroup platform
|
|
|
|
*/
|
2012-08-03 02:57:33 +02:00
|
|
|
GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @ingroup platform
|
|
|
|
*/
|
2012-08-30 01:53:23 +02:00
|
|
|
void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode);
|
2010-09-07 17:34:51 +02:00
|
|
|
|
2013-01-02 02:21:38 +01:00
|
|
|
/*! @brief Returns the current system gamma ramp.
|
|
|
|
* @param[out] ramp The current system gamma ramp.
|
|
|
|
* @ingroup platform
|
|
|
|
*/
|
2010-10-13 22:42:31 +02:00
|
|
|
void _glfwPlatformGetGammaRamp(GLFWgammaramp* ramp);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @brief Sets the system gamma ramp.
|
|
|
|
* @param[in] ramp The desired system gamma ramp.
|
|
|
|
* @ingroup platform
|
|
|
|
*/
|
2010-10-13 04:04:43 +02:00
|
|
|
void _glfwPlatformSetGammaRamp(const GLFWgammaramp* ramp);
|
|
|
|
|
2013-01-02 02:21:38 +01:00
|
|
|
/*! @brief Sets the system clipboard to the specified string.
|
|
|
|
* @param[in] window The window who will own the system clipboard contents, on
|
|
|
|
* systems where this is necessary.
|
|
|
|
* @param[in] string The UTF-8 encoded string to use.
|
|
|
|
* @ingroup platform
|
|
|
|
*/
|
2012-04-09 16:00:54 +02:00
|
|
|
void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @brief Returns the string in the system clipboard.
|
|
|
|
* @param[in] window The window who will request the system clipboard contents,
|
|
|
|
* on systems where this is necessary.
|
|
|
|
* @return The UTF-8 encoded contents, or @c NULL if the system clipboard did
|
|
|
|
* not contain a string.
|
|
|
|
* @ingroup platform
|
|
|
|
*
|
|
|
|
* @note The returned string must be valid until the next call to @ref
|
|
|
|
* _glfwPlatformGetClipboardString or @ref _glfwPlatformSetClipboardString.
|
|
|
|
*/
|
2012-04-12 00:51:58 +02:00
|
|
|
const char* _glfwPlatformGetClipboardString(_GLFWwindow* window);
|
2011-09-21 11:09:47 +02:00
|
|
|
|
2013-01-02 02:21:38 +01:00
|
|
|
/*! @brief Returns the value of the specified joystick property.
|
|
|
|
* @param[in] joy The joystick to use.
|
|
|
|
* @param[in] param The property whose value to return.
|
|
|
|
* @return The value of the specified property, or zero if an error occurred.
|
|
|
|
* @ingroup platform
|
|
|
|
*/
|
2010-09-08 17:30:21 +02:00
|
|
|
int _glfwPlatformGetJoystickParam(int joy, int param);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @ingroup platform
|
|
|
|
*/
|
2012-08-29 18:31:12 +02:00
|
|
|
int _glfwPlatformGetJoystickAxes(int joy, float* axes, int numaxes);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @ingroup platform
|
|
|
|
*/
|
2010-09-08 17:30:21 +02:00
|
|
|
int _glfwPlatformGetJoystickButtons(int joy, unsigned char* buttons, int numbuttons);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @ingroup platform
|
|
|
|
*/
|
2012-09-07 01:01:34 +02:00
|
|
|
const char* _glfwPlatformGetJoystickName(int joy);
|
2010-09-07 17:34:51 +02:00
|
|
|
|
2013-01-02 02:21:38 +01:00
|
|
|
/*! @brief Returns the current value of the timer.
|
|
|
|
* @return The value, in seconds, of the timer.
|
|
|
|
* @ingroup platform
|
|
|
|
*/
|
2010-09-08 17:30:21 +02:00
|
|
|
double _glfwPlatformGetTime(void);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @brief Sets the value of the timer.
|
|
|
|
* @param[in] time The new value, in seconds, of the timer.
|
|
|
|
* @ingroup platform
|
|
|
|
*/
|
2010-09-08 17:30:21 +02:00
|
|
|
void _glfwPlatformSetTime(double time);
|
2010-09-07 17:34:51 +02:00
|
|
|
|
2013-01-02 02:21:38 +01:00
|
|
|
/*! @ingroup platform
|
|
|
|
*/
|
|
|
|
int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|
|
|
const _GLFWwndconfig* wndconfig,
|
|
|
|
const _GLFWfbconfig* fbconfig);
|
|
|
|
|
|
|
|
/*! @ingroup platform
|
|
|
|
*/
|
2012-08-06 17:56:41 +02:00
|
|
|
void _glfwPlatformDestroyWindow(_GLFWwindow* window);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @ingroup platform
|
|
|
|
*/
|
2010-09-09 18:15:32 +02:00
|
|
|
void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
2013-01-24 19:30:31 +01:00
|
|
|
/*! @ingroup platform
|
|
|
|
*/
|
|
|
|
void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos);
|
|
|
|
|
|
|
|
/*! @ingroup platform
|
|
|
|
*/
|
|
|
|
void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos);
|
|
|
|
|
2012-11-25 14:53:33 +01:00
|
|
|
/*! @ingroup platform
|
|
|
|
*/
|
|
|
|
void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height);
|
|
|
|
|
2013-01-02 02:21:38 +01:00
|
|
|
/*! @ingroup platform
|
|
|
|
*/
|
2010-09-09 18:15:32 +02:00
|
|
|
void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @ingroup platform
|
|
|
|
*/
|
2010-09-09 18:15:32 +02:00
|
|
|
void _glfwPlatformIconifyWindow(_GLFWwindow* window);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @ingroup platform
|
|
|
|
*/
|
2010-09-09 18:15:32 +02:00
|
|
|
void _glfwPlatformRestoreWindow(_GLFWwindow* window);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @ingroup platform
|
|
|
|
*/
|
2012-08-21 20:01:57 +02:00
|
|
|
void _glfwPlatformShowWindow(_GLFWwindow* window);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @ingroup platform
|
|
|
|
*/
|
2012-08-21 20:01:57 +02:00
|
|
|
void _glfwPlatformHideWindow(_GLFWwindow* window);
|
2010-09-09 18:15:32 +02:00
|
|
|
|
2013-01-02 02:21:38 +01:00
|
|
|
/*! @ingroup platform
|
|
|
|
*/
|
2010-09-09 18:15:32 +02:00
|
|
|
void _glfwPlatformPollEvents(void);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @ingroup platform
|
|
|
|
*/
|
2010-09-09 18:15:32 +02:00
|
|
|
void _glfwPlatformWaitEvents(void);
|
|
|
|
|
2013-01-02 02:21:38 +01:00
|
|
|
/*! @ingroup platform
|
|
|
|
*/
|
2011-07-27 16:01:27 +02:00
|
|
|
void _glfwPlatformMakeContextCurrent(_GLFWwindow* window);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @ingroup platform
|
|
|
|
*/
|
2012-08-12 14:13:18 +02:00
|
|
|
_GLFWwindow* _glfwPlatformGetCurrentContext(void);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @ingroup platform
|
|
|
|
*/
|
2012-08-06 18:13:37 +02:00
|
|
|
void _glfwPlatformSwapBuffers(_GLFWwindow* window);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @ingroup platform
|
|
|
|
*/
|
2010-09-08 17:30:21 +02:00
|
|
|
void _glfwPlatformSwapInterval(int interval);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @ingroup platform
|
|
|
|
*/
|
|
|
|
int _glfwPlatformExtensionSupported(const char* extension);
|
|
|
|
|
|
|
|
/*! @ingroup platform
|
|
|
|
*/
|
|
|
|
GLFWglproc _glfwPlatformGetProcAddress(const char* procname);
|
|
|
|
|
|
|
|
/*! @ingroup platform
|
|
|
|
*/
|
|
|
|
int _glfwPlatformExtensionSupported(const char* extension);
|
|
|
|
|
|
|
|
/*! @brief Returns the address of the specified client API function.
|
|
|
|
* @param[in] procname The name of the desired function.
|
|
|
|
* @return The address of the function, or @c NULL if it is not available.
|
|
|
|
* @ingroup platform
|
|
|
|
*/
|
2012-06-05 00:16:40 +02:00
|
|
|
GLFWglproc _glfwPlatformGetProcAddress(const char* procname);
|
2010-09-07 17:34:51 +02:00
|
|
|
|
|
|
|
|
|
|
|
//========================================================================
|
2013-01-02 02:21:38 +01:00
|
|
|
// Event API functions
|
2010-09-07 17:34:51 +02:00
|
|
|
//========================================================================
|
|
|
|
|
2013-01-02 02:21:38 +01:00
|
|
|
/*! @brief Notifies shared code of a window focus event.
|
|
|
|
* @param[in] window The window that received the event.
|
|
|
|
* @param[in] focused @c GL_TRUE if the window received focus, or @c GL_FALSE
|
|
|
|
* if it lost focus.
|
|
|
|
* @ingroup event
|
|
|
|
*/
|
2012-11-22 17:04:44 +01:00
|
|
|
void _glfwInputWindowFocus(_GLFWwindow* window, GLboolean focused);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @brief Notifies shared code of a window movement event.
|
|
|
|
* @param[in] window The window that received the event.
|
|
|
|
* @param[in] x The new x-coordinate of the client area of the window.
|
|
|
|
* @param[in] x The new y-coordinate of the client area of the window.
|
|
|
|
* @ingroup event
|
|
|
|
*/
|
2011-10-09 17:10:40 +02:00
|
|
|
void _glfwInputWindowPos(_GLFWwindow* window, int x, int y);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @brief Notifies shared code of a window resize event.
|
|
|
|
* @param[in] window The window that received the event.
|
|
|
|
* @param[in] width The new width of the client area of the window.
|
|
|
|
* @param[in] height The new height of the client area of the window.
|
|
|
|
* @ingroup event
|
|
|
|
*/
|
2011-10-09 17:10:40 +02:00
|
|
|
void _glfwInputWindowSize(_GLFWwindow* window, int width, int height);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @brief Notifies shared code of a window iconification event.
|
|
|
|
* @param[in] window The window that received the event.
|
|
|
|
* @param[in] iconified @c GL_TRUE if the window was iconified, or @c GL_FALSE
|
|
|
|
* if it was restored.
|
|
|
|
* @ingroup event
|
|
|
|
*/
|
2011-10-09 17:10:40 +02:00
|
|
|
void _glfwInputWindowIconify(_GLFWwindow* window, int iconified);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @brief Notifies shared code of a window show/hide event.
|
|
|
|
* @param[in] window The window that received the event.
|
|
|
|
* @param[in] visible @c GL_TRUE if the window was shown, or @c GL_FALSE if it
|
|
|
|
* was hidden.
|
|
|
|
* @ingroup event
|
|
|
|
*/
|
2012-08-21 21:18:09 +02:00
|
|
|
void _glfwInputWindowVisibility(_GLFWwindow* window, int visible);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @brief Notifies shared code of a window damage event.
|
|
|
|
* @param[in] window The window that received the event.
|
|
|
|
*/
|
2011-10-09 21:12:13 +02:00
|
|
|
void _glfwInputWindowDamage(_GLFWwindow* window);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @brief Notifies shared code of a window close request event
|
|
|
|
* @param[in] window The window that received the event.
|
|
|
|
* @ingroup event
|
|
|
|
*/
|
2012-08-10 13:31:15 +02:00
|
|
|
void _glfwInputWindowCloseRequest(_GLFWwindow* window);
|
2011-10-09 17:10:40 +02:00
|
|
|
|
2013-01-02 02:21:38 +01:00
|
|
|
/*! @brief Notifies shared code of a physical key event.
|
|
|
|
* @param[in] window The window that received the event.
|
|
|
|
* @param[in] key The key that was pressed or released.
|
|
|
|
* @param[in] action @ref GLFW_PRESS or @ref GLFW_RELEASE.
|
|
|
|
* @ingroup event
|
|
|
|
*/
|
2010-09-09 18:15:32 +02:00
|
|
|
void _glfwInputKey(_GLFWwindow* window, int key, int action);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @brief Notifies shared code of a Unicode character input event.
|
|
|
|
* @param[in] window The window that received the event.
|
|
|
|
* @param[in] character The Unicode code point of the input character.
|
|
|
|
* @ingroup event
|
|
|
|
*/
|
2010-09-09 19:33:37 +02:00
|
|
|
void _glfwInputChar(_GLFWwindow* window, int character);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @brief Notifies shared code of a scroll event.
|
|
|
|
* @param[in] window The window that received the event.
|
|
|
|
* @param[in] x The scroll offset along the x-axis.
|
|
|
|
* @param[in] y The scroll offset along the y-axis.
|
|
|
|
* @ingroup event
|
|
|
|
*/
|
2012-03-28 21:54:09 +02:00
|
|
|
void _glfwInputScroll(_GLFWwindow* window, double x, double y);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @brief Notifies shared code of a mouse button click event.
|
|
|
|
* @param[in] window The window that received the event.
|
|
|
|
* @param[in] button The button that was pressed or released.
|
|
|
|
* @param[in] action @ref GLFW_PRESS or @ref GLFW_RELEASE.
|
|
|
|
* @ingroup event
|
|
|
|
*/
|
2010-09-09 18:15:32 +02:00
|
|
|
void _glfwInputMouseClick(_GLFWwindow* window, int button, int action);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @brief Notifies shared code of a cursor motion event.
|
|
|
|
* @param[in] window The window that received the event.
|
|
|
|
* @param[in] x The new x-coordinate of the cursor, relative to the left edge
|
|
|
|
* of the client area of the window.
|
|
|
|
* @param[in] y The new y-coordinate of the cursor, relative to the top edge
|
|
|
|
* of the client area of the window.
|
|
|
|
* @ingroup event
|
|
|
|
*/
|
2011-10-09 17:10:40 +02:00
|
|
|
void _glfwInputCursorMotion(_GLFWwindow* window, int x, int y);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @brief Notifies shared code of a cursor enter/leave event.
|
|
|
|
* @param[in] window The window that received the event.
|
|
|
|
* @param[in] entered @c GL_TRUE if the cursor entered the client area of the
|
|
|
|
* window, or @c GL_FALSE if it left it.
|
|
|
|
* @ingroup event
|
|
|
|
*/
|
2012-01-30 22:59:38 +01:00
|
|
|
void _glfwInputCursorEnter(_GLFWwindow* window, int entered);
|
2010-09-07 17:34:51 +02:00
|
|
|
|
2013-01-02 02:21:38 +01:00
|
|
|
/*! @ingroup event
|
|
|
|
*/
|
2012-09-12 19:35:52 +02:00
|
|
|
void _glfwInputMonitorChange(void);
|
|
|
|
|
2013-01-02 02:21:38 +01:00
|
|
|
/*! @brief Notifies shared code of an error.
|
|
|
|
* @param[in] error The error code most suitable for the error.
|
|
|
|
* @param[in] format The @c printf style format string of the error
|
|
|
|
* description.
|
|
|
|
* @ingroup event
|
|
|
|
*/
|
2012-12-31 21:05:28 +01:00
|
|
|
void _glfwInputError(int error, const char* format, ...);
|
|
|
|
|
2012-08-27 03:25:58 +02:00
|
|
|
|
|
|
|
//========================================================================
|
2013-01-02 02:21:38 +01:00
|
|
|
// Utility functions
|
2012-08-27 03:25:58 +02:00
|
|
|
//========================================================================
|
|
|
|
|
2013-01-02 02:21:38 +01:00
|
|
|
/*! @ingroup utility
|
|
|
|
*/
|
2013-01-02 17:29:24 +01:00
|
|
|
const GLFWvidmode* _glfwChooseVideoMode(_GLFWmonitor* monitor,
|
|
|
|
const GLFWvidmode* desired);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @brief Performs lexical comparison between two @ref GLFWvidmode structures.
|
|
|
|
* @ingroup utility
|
|
|
|
*/
|
2012-08-27 03:25:58 +02:00
|
|
|
int _glfwCompareVideoModes(const GLFWvidmode* first, const GLFWvidmode* second);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @brief Splits a color depth into red, green and blue bit depths.
|
|
|
|
* @ingroup utility
|
|
|
|
*/
|
2012-08-27 03:25:58 +02:00
|
|
|
void _glfwSplitBPP(int bpp, int* red, int* green, int* blue);
|
|
|
|
|
2013-01-02 02:21:38 +01:00
|
|
|
/*! @brief Searches an extension string for the specified extension.
|
|
|
|
* @param[in] string The extension string to search.
|
|
|
|
* @param[in] extension The extension to search for.
|
|
|
|
* @return @c GL_TRUE if the extension was found, or @c GL_FALSE otherwise.
|
|
|
|
* @ingroup utility
|
|
|
|
*/
|
2010-09-08 17:30:21 +02:00
|
|
|
int _glfwStringInExtensionString(const char* string, const GLubyte* extensions);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @brief Checks and reads back properties from the current context.
|
|
|
|
* @return @c GL_TRUE if successful, or @c GL_FALSE if the context is unusable.
|
|
|
|
* @ingroup utility
|
|
|
|
*/
|
2012-08-02 14:42:24 +02:00
|
|
|
GLboolean _glfwRefreshContextParams(void);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @brief Checks whether the desired context properties are valid.
|
|
|
|
* @param[in] wndconfig The context properties to check.
|
|
|
|
* @return @c GL_TRUE if the context properties are valid, or @c GL_FALSE
|
|
|
|
* otherwise.
|
|
|
|
* @ingroup utility
|
|
|
|
*
|
|
|
|
* This function checks things like whether the specified client API version
|
|
|
|
* exists and whether all relevant options have supported and non-conflicting
|
|
|
|
* values.
|
|
|
|
*/
|
2011-03-07 14:55:11 +01:00
|
|
|
GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @brief Checks whether the current context fulfils the specified hard
|
|
|
|
* constraints.
|
|
|
|
* @param[in] wndconfig The desired context properties.
|
|
|
|
* @return @c GL_TRUE if the context fulfils the hard constraints, or @c
|
|
|
|
* GL_FALSE otherwise.
|
|
|
|
* @ingroup utility
|
|
|
|
*/
|
2012-08-02 14:42:24 +02:00
|
|
|
GLboolean _glfwIsValidContext(_GLFWwndconfig* wndconfig);
|
2010-09-07 17:34:51 +02:00
|
|
|
|
2013-01-02 02:21:38 +01:00
|
|
|
/*! @ingroup utility
|
|
|
|
*/
|
2012-09-12 19:35:52 +02:00
|
|
|
_GLFWmonitor* _glfwCreateMonitor(const char* name,
|
2012-09-13 17:46:40 +02:00
|
|
|
GLboolean primary,
|
2013-01-02 16:48:02 +01:00
|
|
|
int widthMM, int heightMM,
|
2012-10-22 02:39:22 +02:00
|
|
|
int x, int y);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @ingroup utility
|
|
|
|
*/
|
2012-09-12 19:35:52 +02:00
|
|
|
void _glfwDestroyMonitor(_GLFWmonitor* monitor);
|
2013-01-02 02:21:38 +01:00
|
|
|
|
|
|
|
/*! @ingroup utility
|
|
|
|
*/
|
2012-09-12 19:35:52 +02:00
|
|
|
void _glfwDestroyMonitors(void);
|
2010-09-07 17:34:51 +02:00
|
|
|
|
|
|
|
#endif // _internal_h_
|