mirror of
https://github.com/glfw/glfw.git
synced 2024-11-25 19:42:00 +00:00
Made the pointer-ness of object handles explicit.
This commit is contained in:
parent
fc79e0a3a8
commit
9af960e2dd
@ -42,7 +42,7 @@
|
|||||||
/* Prototypes */
|
/* Prototypes */
|
||||||
void init( void );
|
void init( void );
|
||||||
void display( void );
|
void display( void );
|
||||||
void reshape( GLFWwindow window, int w, int h );
|
void reshape( GLFWwindow* window, int w, int h );
|
||||||
void DrawBoingBall( void );
|
void DrawBoingBall( void );
|
||||||
void BounceBall( double dt );
|
void BounceBall( double dt );
|
||||||
void DrawBoingBallBand( GLfloat long_lo, GLfloat long_hi );
|
void DrawBoingBallBand( GLfloat long_lo, GLfloat long_hi );
|
||||||
@ -224,7 +224,7 @@ void display(void)
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* reshape()
|
* reshape()
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
void reshape( GLFWwindow window, int w, int h )
|
void reshape( GLFWwindow* window, int w, int h )
|
||||||
{
|
{
|
||||||
glViewport( 0, 0, (GLsizei)w, (GLsizei)h );
|
glViewport( 0, 0, (GLsizei)w, (GLsizei)h );
|
||||||
|
|
||||||
@ -567,7 +567,7 @@ void DrawGrid( void )
|
|||||||
|
|
||||||
int main( void )
|
int main( void )
|
||||||
{
|
{
|
||||||
GLFWwindow window;
|
GLFWwindow* window;
|
||||||
int width, height;
|
int width, height;
|
||||||
|
|
||||||
/* Init GLFW */
|
/* Init GLFW */
|
||||||
|
@ -215,7 +215,7 @@ static void animate(void)
|
|||||||
|
|
||||||
|
|
||||||
/* change view angle, exit upon ESC */
|
/* change view angle, exit upon ESC */
|
||||||
void key( GLFWwindow window, int k, int action )
|
void key( GLFWwindow* window, int k, int action )
|
||||||
{
|
{
|
||||||
if( action != GLFW_PRESS ) return;
|
if( action != GLFW_PRESS ) return;
|
||||||
|
|
||||||
@ -248,7 +248,7 @@ void key( GLFWwindow window, int k, int action )
|
|||||||
|
|
||||||
|
|
||||||
/* new window size */
|
/* new window size */
|
||||||
void reshape( GLFWwindow window, int width, int height )
|
void reshape( GLFWwindow* window, int width, int height )
|
||||||
{
|
{
|
||||||
GLfloat h = (GLfloat) height / (GLfloat) width;
|
GLfloat h = (GLfloat) height / (GLfloat) width;
|
||||||
GLfloat xmax, znear, zfar;
|
GLfloat xmax, znear, zfar;
|
||||||
@ -268,7 +268,7 @@ void reshape( GLFWwindow window, int width, int height )
|
|||||||
|
|
||||||
|
|
||||||
/* close callback */
|
/* close callback */
|
||||||
static int window_close_callback(GLFWwindow window)
|
static int window_close_callback(GLFWwindow* window)
|
||||||
{
|
{
|
||||||
running = 0;
|
running = 0;
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
@ -329,7 +329,7 @@ static void init(int argc, char *argv[])
|
|||||||
/* program entry */
|
/* program entry */
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
GLFWwindow window;
|
GLFWwindow* window;
|
||||||
int width, height;
|
int width, height;
|
||||||
|
|
||||||
if( !glfwInit() )
|
if( !glfwInit() )
|
||||||
|
@ -484,7 +484,7 @@ static void update_mesh(void)
|
|||||||
static GLboolean running = GL_TRUE;
|
static GLboolean running = GL_TRUE;
|
||||||
|
|
||||||
/* GLFW Window management functions */
|
/* GLFW Window management functions */
|
||||||
static int window_close_callback(GLFWwindow window)
|
static int window_close_callback(GLFWwindow* window)
|
||||||
{
|
{
|
||||||
running = GL_FALSE;
|
running = GL_FALSE;
|
||||||
|
|
||||||
@ -493,7 +493,7 @@ static int window_close_callback(GLFWwindow window)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void key_callback(GLFWwindow window, int key, int action)
|
static void key_callback(GLFWwindow* window, int key, int action)
|
||||||
{
|
{
|
||||||
switch(key)
|
switch(key)
|
||||||
{
|
{
|
||||||
@ -513,7 +513,7 @@ static void usage(void)
|
|||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
GLFWwindow window;
|
GLFWwindow* window;
|
||||||
int ch, iter;
|
int ch, iter;
|
||||||
double dt;
|
double dt;
|
||||||
double last_update_time;
|
double last_update_time;
|
||||||
|
@ -357,7 +357,7 @@ static void drawAllViews(void)
|
|||||||
// Window size callback function
|
// Window size callback function
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
static void windowSizeFun(GLFWwindow window, int w, int h)
|
static void windowSizeFun(GLFWwindow* window, int w, int h)
|
||||||
{
|
{
|
||||||
width = w;
|
width = w;
|
||||||
height = h > 0 ? h : 1;
|
height = h > 0 ? h : 1;
|
||||||
@ -369,7 +369,7 @@ static void windowSizeFun(GLFWwindow window, int w, int h)
|
|||||||
// Window refresh callback function
|
// Window refresh callback function
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
static void windowRefreshFun(GLFWwindow window)
|
static void windowRefreshFun(GLFWwindow* window)
|
||||||
{
|
{
|
||||||
do_redraw = 1;
|
do_redraw = 1;
|
||||||
}
|
}
|
||||||
@ -379,7 +379,7 @@ static void windowRefreshFun(GLFWwindow window)
|
|||||||
// Mouse position callback function
|
// Mouse position callback function
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
static void cursorPosFun(GLFWwindow window, int x, int y)
|
static void cursorPosFun(GLFWwindow* window, int x, int y)
|
||||||
{
|
{
|
||||||
// Depending on which view was selected, rotate around different axes
|
// Depending on which view was selected, rotate around different axes
|
||||||
switch (active_view)
|
switch (active_view)
|
||||||
@ -414,7 +414,7 @@ static void cursorPosFun(GLFWwindow window, int x, int y)
|
|||||||
// Mouse button callback function
|
// Mouse button callback function
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
static void mouseButtonFun(GLFWwindow window, int button, int action)
|
static void mouseButtonFun(GLFWwindow* window, int button, int action)
|
||||||
{
|
{
|
||||||
if ((button == GLFW_MOUSE_BUTTON_LEFT) && action == GLFW_PRESS)
|
if ((button == GLFW_MOUSE_BUTTON_LEFT) && action == GLFW_PRESS)
|
||||||
{
|
{
|
||||||
@ -441,7 +441,7 @@ static void mouseButtonFun(GLFWwindow window, int button, int action)
|
|||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
GLFWwindow window;
|
GLFWwindow* window;
|
||||||
|
|
||||||
// Initialise GLFW
|
// Initialise GLFW
|
||||||
if (!glfwInit())
|
if (!glfwInit())
|
||||||
|
@ -18,7 +18,7 @@ static void error_callback(int error, const char* description)
|
|||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
int width, height, x;
|
int width, height, x;
|
||||||
GLFWwindow window;
|
GLFWwindow* window;
|
||||||
|
|
||||||
glfwSetErrorCallback(error_callback);
|
glfwSetErrorCallback(error_callback);
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ void init_grid(void)
|
|||||||
// Draw scene
|
// Draw scene
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
void draw_scene(GLFWwindow window)
|
void draw_scene(GLFWwindow* window)
|
||||||
{
|
{
|
||||||
// Clear the color and depth buffers
|
// Clear the color and depth buffers
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
@ -271,7 +271,7 @@ static void error_callback(int error, const char* description)
|
|||||||
// Handle key strokes
|
// Handle key strokes
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
void key_callback(GLFWwindow window, int key, int action)
|
void key_callback(GLFWwindow* window, int key, int action)
|
||||||
{
|
{
|
||||||
if (action != GLFW_PRESS)
|
if (action != GLFW_PRESS)
|
||||||
return;
|
return;
|
||||||
@ -314,7 +314,7 @@ void key_callback(GLFWwindow window, int key, int action)
|
|||||||
// Callback function for mouse button events
|
// Callback function for mouse button events
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
void mouse_button_callback(GLFWwindow window, int button, int action)
|
void mouse_button_callback(GLFWwindow* window, int button, int action)
|
||||||
{
|
{
|
||||||
if (button != GLFW_MOUSE_BUTTON_LEFT)
|
if (button != GLFW_MOUSE_BUTTON_LEFT)
|
||||||
return;
|
return;
|
||||||
@ -336,7 +336,7 @@ void mouse_button_callback(GLFWwindow window, int button, int action)
|
|||||||
// Callback function for cursor motion events
|
// Callback function for cursor motion events
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
void cursor_position_callback(GLFWwindow window, int x, int y)
|
void cursor_position_callback(GLFWwindow* window, int x, int y)
|
||||||
{
|
{
|
||||||
if (locked)
|
if (locked)
|
||||||
{
|
{
|
||||||
@ -353,7 +353,7 @@ void cursor_position_callback(GLFWwindow window, int x, int y)
|
|||||||
// Callback function for scroll events
|
// Callback function for scroll events
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
void scroll_callback(GLFWwindow window, double x, double y)
|
void scroll_callback(GLFWwindow* window, double x, double y)
|
||||||
{
|
{
|
||||||
zoom += (float) y / 4.f;
|
zoom += (float) y / 4.f;
|
||||||
if (zoom < 0)
|
if (zoom < 0)
|
||||||
@ -365,7 +365,7 @@ void scroll_callback(GLFWwindow window, double x, double y)
|
|||||||
// Callback function for window resize events
|
// Callback function for window resize events
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
void window_size_callback(GLFWwindow window, int width, int height)
|
void window_size_callback(GLFWwindow* window, int width, int height)
|
||||||
{
|
{
|
||||||
float ratio = 1.f;
|
float ratio = 1.f;
|
||||||
|
|
||||||
@ -386,7 +386,7 @@ void window_size_callback(GLFWwindow window, int width, int height)
|
|||||||
// Callback function for window close events
|
// Callback function for window close events
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
static int window_close_callback(GLFWwindow window)
|
static int window_close_callback(GLFWwindow* window)
|
||||||
{
|
{
|
||||||
running = GL_FALSE;
|
running = GL_FALSE;
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
@ -399,7 +399,7 @@ static int window_close_callback(GLFWwindow window)
|
|||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
GLFWwindow window;
|
GLFWwindow* window;
|
||||||
double t, dt_total, t_old;
|
double t, dt_total, t_old;
|
||||||
int width, height;
|
int width, height;
|
||||||
|
|
||||||
|
@ -763,12 +763,12 @@ typedef void (*GLFWglproc)(void);
|
|||||||
/*! @brief Monitor handle type.
|
/*! @brief Monitor handle type.
|
||||||
* @ingroup monitor
|
* @ingroup monitor
|
||||||
*/
|
*/
|
||||||
typedef void* GLFWmonitor;
|
typedef struct GLFWmonitor GLFWmonitor;
|
||||||
|
|
||||||
/*! @brief Window handle type.
|
/*! @brief Window handle type.
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
*/
|
*/
|
||||||
typedef void* GLFWwindow;
|
typedef struct GLFWwindow GLFWwindow;
|
||||||
|
|
||||||
/*! @brief The function signature for error callbacks.
|
/*! @brief The function signature for error callbacks.
|
||||||
* @param[in] error An @link errors error code @endlink.
|
* @param[in] error An @link errors error code @endlink.
|
||||||
@ -785,7 +785,7 @@ typedef void (* GLFWerrorfun)(int,const char*);
|
|||||||
* the client area of the window.
|
* the client area of the window.
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWwindowposfun)(GLFWwindow,int,int);
|
typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int);
|
||||||
|
|
||||||
/*! @brief The function signature for window resize callbacks.
|
/*! @brief The function signature for window resize callbacks.
|
||||||
* @param[in] window The window that the user resized.
|
* @param[in] window The window that the user resized.
|
||||||
@ -793,7 +793,7 @@ typedef void (* GLFWwindowposfun)(GLFWwindow,int,int);
|
|||||||
* @param[in] height The new height, in pixels, of the window.
|
* @param[in] height The new height, in pixels, of the window.
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWwindowsizefun)(GLFWwindow,int,int);
|
typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int);
|
||||||
|
|
||||||
/*! @brief The function signature for window close callbacks.
|
/*! @brief The function signature for window close callbacks.
|
||||||
* @param[in] window The window that the user attempted to close.
|
* @param[in] window The window that the user attempted to close.
|
||||||
@ -801,13 +801,13 @@ typedef void (* GLFWwindowsizefun)(GLFWwindow,int,int);
|
|||||||
* ignore the attempt.
|
* ignore the attempt.
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
*/
|
*/
|
||||||
typedef int (* GLFWwindowclosefun)(GLFWwindow);
|
typedef int (* GLFWwindowclosefun)(GLFWwindow*);
|
||||||
|
|
||||||
/*! @brief The function signature for window content refresh callbacks.
|
/*! @brief The function signature for window content refresh callbacks.
|
||||||
* @param[in] window The window whose content needs to be refreshed.
|
* @param[in] window The window whose content needs to be refreshed.
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWwindowrefreshfun)(GLFWwindow);
|
typedef void (* GLFWwindowrefreshfun)(GLFWwindow*);
|
||||||
|
|
||||||
/*! @brief The function signature for window focus/defocus callbacks.
|
/*! @brief The function signature for window focus/defocus callbacks.
|
||||||
* @param[in] window The window that was focused or defocused.
|
* @param[in] window The window that was focused or defocused.
|
||||||
@ -815,7 +815,7 @@ typedef void (* GLFWwindowrefreshfun)(GLFWwindow);
|
|||||||
* it was defocused.
|
* it was defocused.
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWwindowfocusfun)(GLFWwindow,int);
|
typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int);
|
||||||
|
|
||||||
/*! @brief The function signature for window iconify/restore callbacks.
|
/*! @brief The function signature for window iconify/restore callbacks.
|
||||||
* @param[in] window The window that was iconified or restored.
|
* @param[in] window The window that was iconified or restored.
|
||||||
@ -823,7 +823,7 @@ typedef void (* GLFWwindowfocusfun)(GLFWwindow,int);
|
|||||||
* if it was restored.
|
* if it was restored.
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWwindowiconifyfun)(GLFWwindow,int);
|
typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int);
|
||||||
|
|
||||||
/*! @brief The function signature for mouse button callbacks.
|
/*! @brief The function signature for mouse button callbacks.
|
||||||
* @param[in] window The window that received the event.
|
* @param[in] window The window that received the event.
|
||||||
@ -832,7 +832,7 @@ typedef void (* GLFWwindowiconifyfun)(GLFWwindow,int);
|
|||||||
* @param[in] action @ref GLFW_PRESS or @ref GLFW_RELEASE.
|
* @param[in] action @ref GLFW_PRESS or @ref GLFW_RELEASE.
|
||||||
* @ingroup input
|
* @ingroup input
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWmousebuttonfun)(GLFWwindow,int,int);
|
typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int);
|
||||||
|
|
||||||
/*! @brief The function signature for cursor position callbacks.
|
/*! @brief The function signature for cursor position callbacks.
|
||||||
* @param[in] window The window that received the event.
|
* @param[in] window The window that received the event.
|
||||||
@ -840,7 +840,7 @@ typedef void (* GLFWmousebuttonfun)(GLFWwindow,int,int);
|
|||||||
* @param[in] y The new y-coordinate of the cursor.
|
* @param[in] y The new y-coordinate of the cursor.
|
||||||
* @ingroup input
|
* @ingroup input
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWcursorposfun)(GLFWwindow,int,int);
|
typedef void (* GLFWcursorposfun)(GLFWwindow*,int,int);
|
||||||
|
|
||||||
/*! @brief The function signature for cursor enter/exit callbacks.
|
/*! @brief The function signature for cursor enter/exit callbacks.
|
||||||
* @param[in] window The window that received the event.
|
* @param[in] window The window that received the event.
|
||||||
@ -848,7 +848,7 @@ typedef void (* GLFWcursorposfun)(GLFWwindow,int,int);
|
|||||||
* area, or @c GL_FALSE if it left it.
|
* area, or @c GL_FALSE if it left it.
|
||||||
* @ingroup input
|
* @ingroup input
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWcursorenterfun)(GLFWwindow,int);
|
typedef void (* GLFWcursorenterfun)(GLFWwindow*,int);
|
||||||
|
|
||||||
/*! @brief The function signature for scroll callbacks.
|
/*! @brief The function signature for scroll callbacks.
|
||||||
* @param[in] window The window that received the event.
|
* @param[in] window The window that received the event.
|
||||||
@ -856,7 +856,7 @@ typedef void (* GLFWcursorenterfun)(GLFWwindow,int);
|
|||||||
* @param[in] y The scroll offset along the y-axis.
|
* @param[in] y The scroll offset along the y-axis.
|
||||||
* @ingroup input
|
* @ingroup input
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWscrollfun)(GLFWwindow,double,double);
|
typedef void (* GLFWscrollfun)(GLFWwindow*,double,double);
|
||||||
|
|
||||||
/*! @brief The function signature for keyboard key callbacks.
|
/*! @brief The function signature for keyboard key callbacks.
|
||||||
* @param[in] window The window that received the event.
|
* @param[in] window The window that received the event.
|
||||||
@ -865,21 +865,21 @@ typedef void (* GLFWscrollfun)(GLFWwindow,double,double);
|
|||||||
* @param[in] action @ref GLFW_PRESS or @ref GLFW_RELEASE.
|
* @param[in] action @ref GLFW_PRESS or @ref GLFW_RELEASE.
|
||||||
* @ingroup input
|
* @ingroup input
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWkeyfun)(GLFWwindow,int,int);
|
typedef void (* GLFWkeyfun)(GLFWwindow*,int,int);
|
||||||
|
|
||||||
/*! @brief The function signature for Unicode character callbacks.
|
/*! @brief The function signature for Unicode character callbacks.
|
||||||
* @param[in] window The window that received the event.
|
* @param[in] window The window that received the event.
|
||||||
* @param[in] character The Unicode code point of the character.
|
* @param[in] character The Unicode code point of the character.
|
||||||
* @ingroup input
|
* @ingroup input
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWcharfun)(GLFWwindow,int);
|
typedef void (* GLFWcharfun)(GLFWwindow*,int);
|
||||||
|
|
||||||
/*! @brief The function signature for monitor configuration callbacks.
|
/*! @brief The function signature for monitor configuration callbacks.
|
||||||
* @param[in] monitor The monitor that was connected or disconnected.
|
* @param[in] monitor The monitor that was connected or disconnected.
|
||||||
* @param[in] event @ref GLFW_MONITOR_CONNECTED or @ref
|
* @param[in] event @ref GLFW_MONITOR_CONNECTED or @ref
|
||||||
* GLFW_MONITOR_DISCONNECTED.
|
* GLFW_MONITOR_DISCONNECTED.
|
||||||
*/
|
*/
|
||||||
typedef void (* GLFWmonitorfun)(GLFWmonitor,int);
|
typedef void (* GLFWmonitorfun)(GLFWmonitor*,int);
|
||||||
|
|
||||||
/* @brief Video mode type.
|
/* @brief Video mode type.
|
||||||
* @ingroup monitor
|
* @ingroup monitor
|
||||||
@ -1004,25 +1004,25 @@ GLFWAPI void glfwSetErrorCallback(GLFWerrorfun cbfun);
|
|||||||
* @return An array of monitor handles.
|
* @return An array of monitor handles.
|
||||||
* @ingroup monitor
|
* @ingroup monitor
|
||||||
*/
|
*/
|
||||||
GLFWAPI const GLFWmonitor* glfwGetMonitors(int* count);
|
GLFWAPI GLFWmonitor** glfwGetMonitors(int* count);
|
||||||
|
|
||||||
/*! @brief Returns the primary monitor.
|
/*! @brief Returns the primary monitor.
|
||||||
* @return The primary monitor.
|
* @return The primary monitor.
|
||||||
* @ingroup monitor
|
* @ingroup monitor
|
||||||
*/
|
*/
|
||||||
GLFWAPI GLFWmonitor glfwGetPrimaryMonitor(void);
|
GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void);
|
||||||
|
|
||||||
/*! @brief Returns a property of the specified monitor.
|
/*! @brief Returns a property of the specified monitor.
|
||||||
* @ingroup monitor
|
* @ingroup monitor
|
||||||
*/
|
*/
|
||||||
GLFWAPI int glfwGetMonitorParam(GLFWmonitor monitor, int param);
|
GLFWAPI int glfwGetMonitorParam(GLFWmonitor* monitor, int param);
|
||||||
|
|
||||||
/*! @brief Returns the name of the specified monitor.
|
/*! @brief Returns the name of the specified monitor.
|
||||||
* @param[in] monitor The monitor to query.
|
* @param[in] monitor The monitor to query.
|
||||||
* @return The UTF-8 encoded name of the monitor.
|
* @return The UTF-8 encoded name of the monitor.
|
||||||
* @ingroup monitor
|
* @ingroup monitor
|
||||||
*/
|
*/
|
||||||
GLFWAPI const char* glfwGetMonitorName(GLFWmonitor monitor);
|
GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor);
|
||||||
|
|
||||||
/*! @brief Sets the monitor configuration callback.
|
/*! @brief Sets the monitor configuration callback.
|
||||||
* @param[in] cbfun The new callback, or @c NULL to remove the currently set.
|
* @param[in] cbfun The new callback, or @c NULL to remove the currently set.
|
||||||
@ -1036,14 +1036,14 @@ GLFWAPI void glfwSetMonitorCallback(GLFWmonitorfun cbfun);
|
|||||||
* @return An array of video modes.
|
* @return An array of video modes.
|
||||||
* @ingroup monitor
|
* @ingroup monitor
|
||||||
*/
|
*/
|
||||||
GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor monitor, int* count);
|
GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count);
|
||||||
|
|
||||||
/*! @brief Returns the current mode of the specified monitor.
|
/*! @brief Returns the current mode of the specified monitor.
|
||||||
* @param[in] monitor The monitor to query.
|
* @param[in] monitor The monitor to query.
|
||||||
* @param[out] mode The current mode of the monitor.
|
* @param[out] mode The current mode of the monitor.
|
||||||
* @ingroup monitor
|
* @ingroup monitor
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwGetVideoMode(GLFWmonitor monitor, GLFWvidmode* mode);
|
GLFWAPI void glfwGetVideoMode(GLFWmonitor* monitor, GLFWvidmode* mode);
|
||||||
|
|
||||||
/*! @brief Sets the system gamma ramp to one generated from the specified
|
/*! @brief Sets the system gamma ramp to one generated from the specified
|
||||||
* exponent.
|
* exponent.
|
||||||
@ -1242,7 +1242,7 @@ GLFWAPI void glfwWindowHint(int target, int hint);
|
|||||||
*
|
*
|
||||||
* @sa glfwDestroyWindow
|
* @sa glfwDestroyWindow
|
||||||
*/
|
*/
|
||||||
GLFWAPI GLFWwindow glfwCreateWindow(int width, int height, const char* title, GLFWmonitor monitor, GLFWwindow share);
|
GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
|
||||||
|
|
||||||
/*! @brief Destroys the specified window and its context.
|
/*! @brief Destroys the specified window and its context.
|
||||||
* @param[in] window The window to destroy.
|
* @param[in] window The window to destroy.
|
||||||
@ -1261,7 +1261,7 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height, const char* title, GL
|
|||||||
*
|
*
|
||||||
* @sa glfwCreateWindow
|
* @sa glfwCreateWindow
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwDestroyWindow(GLFWwindow window);
|
GLFWAPI void glfwDestroyWindow(GLFWwindow* window);
|
||||||
|
|
||||||
/*! @brief Sets the title of the specified window.
|
/*! @brief Sets the title of the specified window.
|
||||||
* @param[in] window The window whose title to change.
|
* @param[in] window The window whose title to change.
|
||||||
@ -1270,7 +1270,7 @@ GLFWAPI void glfwDestroyWindow(GLFWwindow window);
|
|||||||
*
|
*
|
||||||
* @note This function may only be called from the main thread.
|
* @note This function may only be called from the main thread.
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwSetWindowTitle(GLFWwindow window, const char* title);
|
GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);
|
||||||
|
|
||||||
/*! @brief Retrieves the size of the client area of the specified window.
|
/*! @brief Retrieves the size of the client area of the specified window.
|
||||||
* @param[in] window The window whose size to retrieve.
|
* @param[in] window The window whose size to retrieve.
|
||||||
@ -1280,7 +1280,7 @@ GLFWAPI void glfwSetWindowTitle(GLFWwindow window, const char* title);
|
|||||||
*
|
*
|
||||||
* @sa glfwSetWindowSize
|
* @sa glfwSetWindowSize
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwGetWindowSize(GLFWwindow window, int* width, int* height);
|
GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);
|
||||||
|
|
||||||
/*! @brief Sets the size of the client area of the specified window.
|
/*! @brief Sets the size of the client area of the specified window.
|
||||||
* @param[in] window The window to resize.
|
* @param[in] window The window to resize.
|
||||||
@ -1298,7 +1298,7 @@ GLFWAPI void glfwGetWindowSize(GLFWwindow window, int* width, int* height);
|
|||||||
*
|
*
|
||||||
* @sa glfwGetWindowSize
|
* @sa glfwGetWindowSize
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwSetWindowSize(GLFWwindow window, int width, int height);
|
GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height);
|
||||||
|
|
||||||
/*! @brief Iconifies the specified window.
|
/*! @brief Iconifies the specified window.
|
||||||
* @param[in] window The window to iconify.
|
* @param[in] window The window to iconify.
|
||||||
@ -1310,7 +1310,7 @@ GLFWAPI void glfwSetWindowSize(GLFWwindow window, int width, int height);
|
|||||||
*
|
*
|
||||||
* @sa glfwRestoreWindow
|
* @sa glfwRestoreWindow
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwIconifyWindow(GLFWwindow window);
|
GLFWAPI void glfwIconifyWindow(GLFWwindow* window);
|
||||||
|
|
||||||
/*! @brief Restores the specified window.
|
/*! @brief Restores the specified window.
|
||||||
* @param[in] window The window to restore.
|
* @param[in] window The window to restore.
|
||||||
@ -1322,7 +1322,7 @@ GLFWAPI void glfwIconifyWindow(GLFWwindow window);
|
|||||||
*
|
*
|
||||||
* @sa glfwIconifyWindow
|
* @sa glfwIconifyWindow
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwRestoreWindow(GLFWwindow window);
|
GLFWAPI void glfwRestoreWindow(GLFWwindow* window);
|
||||||
|
|
||||||
/*! @brief Makes the specified window visible.
|
/*! @brief Makes the specified window visible.
|
||||||
* @param[in] window The window to make visible.
|
* @param[in] window The window to make visible.
|
||||||
@ -1335,7 +1335,7 @@ GLFWAPI void glfwRestoreWindow(GLFWwindow window);
|
|||||||
*
|
*
|
||||||
* @sa glfwHideWindow
|
* @sa glfwHideWindow
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwShowWindow(GLFWwindow window);
|
GLFWAPI void glfwShowWindow(GLFWwindow* window);
|
||||||
|
|
||||||
/*! @brief Hides the specified window.
|
/*! @brief Hides the specified window.
|
||||||
* @param[in] window The window to hide.
|
* @param[in] window The window to hide.
|
||||||
@ -1348,14 +1348,14 @@ GLFWAPI void glfwShowWindow(GLFWwindow window);
|
|||||||
*
|
*
|
||||||
* @sa glfwShowWindow
|
* @sa glfwShowWindow
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwHideWindow(GLFWwindow window);
|
GLFWAPI void glfwHideWindow(GLFWwindow* window);
|
||||||
|
|
||||||
/*! @brief Returns the monitor that the window uses for fullscreen mode
|
/*! @brief Returns the monitor that the window uses for fullscreen mode
|
||||||
* @param[in] window The window to query.
|
* @param[in] window The window to query.
|
||||||
* @return The monitor, or @c NULL if the window is in windowed mode.
|
* @return The monitor, or @c NULL if the window is in windowed mode.
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
*/
|
*/
|
||||||
GLFWAPI GLFWmonitor glfwGetWindowMonitor(GLFWwindow window);
|
GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window);
|
||||||
|
|
||||||
/*! @brief Returns a property of the specified window.
|
/*! @brief Returns a property of the specified window.
|
||||||
* @param[in] window The window to query.
|
* @param[in] window The window to query.
|
||||||
@ -1398,7 +1398,7 @@ GLFWAPI GLFWmonitor glfwGetWindowMonitor(GLFWwindow window);
|
|||||||
* The @ref GLFW_CONTEXT_ROBUSTNESS property indicates the robustness strategy
|
* The @ref GLFW_CONTEXT_ROBUSTNESS property indicates the robustness strategy
|
||||||
* used by the context, or @ref GLFW_NO_ROBUSTNESS if robustness is not used.
|
* used by the context, or @ref GLFW_NO_ROBUSTNESS if robustness is not used.
|
||||||
*/
|
*/
|
||||||
GLFWAPI int glfwGetWindowParam(GLFWwindow window, int param);
|
GLFWAPI int glfwGetWindowParam(GLFWwindow* window, int param);
|
||||||
|
|
||||||
/*! @brief Sets the user pointer of the specified window.
|
/*! @brief Sets the user pointer of the specified window.
|
||||||
* @param[in] window The window whose pointer to set.
|
* @param[in] window The window whose pointer to set.
|
||||||
@ -1407,7 +1407,7 @@ GLFWAPI int glfwGetWindowParam(GLFWwindow window, int param);
|
|||||||
*
|
*
|
||||||
* @sa glfwGetWindowUserPointer
|
* @sa glfwGetWindowUserPointer
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwSetWindowUserPointer(GLFWwindow window, void* pointer);
|
GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer);
|
||||||
|
|
||||||
/*! @brief Returns the user pointer of the specified window.
|
/*! @brief Returns the user pointer of the specified window.
|
||||||
* @param[in] window The window whose pointer to return.
|
* @param[in] window The window whose pointer to return.
|
||||||
@ -1415,7 +1415,7 @@ GLFWAPI void glfwSetWindowUserPointer(GLFWwindow window, void* pointer);
|
|||||||
*
|
*
|
||||||
* @sa glfwSetWindowUserPointer
|
* @sa glfwSetWindowUserPointer
|
||||||
*/
|
*/
|
||||||
GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow window);
|
GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window);
|
||||||
|
|
||||||
/*! @brief Sets the position callback for the specified window.
|
/*! @brief Sets the position callback for the specified window.
|
||||||
* @param[in] window The window whose callback to set.
|
* @param[in] window The window whose callback to set.
|
||||||
@ -1423,7 +1423,7 @@ GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow window);
|
|||||||
* callback.
|
* callback.
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwSetWindowPosCallback(GLFWwindow window, GLFWwindowposfun cbfun);
|
GLFWAPI void glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun cbfun);
|
||||||
|
|
||||||
/*! @brief Sets the size callback for the specified window.
|
/*! @brief Sets the size callback for the specified window.
|
||||||
* @param[in] window The window whose callback to set.
|
* @param[in] window The window whose callback to set.
|
||||||
@ -1433,7 +1433,7 @@ GLFWAPI void glfwSetWindowPosCallback(GLFWwindow window, GLFWwindowposfun cbfun)
|
|||||||
*
|
*
|
||||||
* This callback is called when the window is resized.
|
* This callback is called when the window is resized.
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwSetWindowSizeCallback(GLFWwindow window, GLFWwindowsizefun cbfun);
|
GLFWAPI void glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun cbfun);
|
||||||
|
|
||||||
/*! @brief Sets the close callback for the specified window.
|
/*! @brief Sets the close callback for the specified window.
|
||||||
* @param[in] window The window whose callback to set.
|
* @param[in] window The window whose callback to set.
|
||||||
@ -1449,7 +1449,7 @@ GLFWAPI void glfwSetWindowSizeCallback(GLFWwindow window, GLFWwindowsizefun cbfu
|
|||||||
* The return value of the close callback becomes the new value of the @ref
|
* The return value of the close callback becomes the new value of the @ref
|
||||||
* GLFW_SHOULD_CLOSE window parameter.
|
* GLFW_SHOULD_CLOSE window parameter.
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwSetWindowCloseCallback(GLFWwindow window, GLFWwindowclosefun cbfun);
|
GLFWAPI void glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun cbfun);
|
||||||
|
|
||||||
/*! @brief Sets the refresh callback for the specified window.
|
/*! @brief Sets the refresh callback for the specified window.
|
||||||
* @param[in] window The window whose callback to set.
|
* @param[in] window The window whose callback to set.
|
||||||
@ -1464,7 +1464,7 @@ GLFWAPI void glfwSetWindowCloseCallback(GLFWwindow window, GLFWwindowclosefun cb
|
|||||||
* @note On compositing window systems such as Mac OS X, where the window
|
* @note On compositing window systems such as Mac OS X, where the window
|
||||||
* contents are saved off-screen, this callback may never be called.
|
* contents are saved off-screen, this callback may never be called.
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwSetWindowRefreshCallback(GLFWwindow window, GLFWwindowrefreshfun cbfun);
|
GLFWAPI void glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun cbfun);
|
||||||
|
|
||||||
/*! @brief Sets the focus callback for the specified window.
|
/*! @brief Sets the focus callback for the specified window.
|
||||||
* @param[in] window The window whose callback to set.
|
* @param[in] window The window whose callback to set.
|
||||||
@ -1474,7 +1474,7 @@ GLFWAPI void glfwSetWindowRefreshCallback(GLFWwindow window, GLFWwindowrefreshfu
|
|||||||
*
|
*
|
||||||
* This callback is called when the window gains or loses focus.
|
* This callback is called when the window gains or loses focus.
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwSetWindowFocusCallback(GLFWwindow window, GLFWwindowfocusfun cbfun);
|
GLFWAPI void glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun cbfun);
|
||||||
|
|
||||||
/*! @brief Sets the iconify callback for the specified window.
|
/*! @brief Sets the iconify callback for the specified window.
|
||||||
* @param[in] window The window whose callback to set.
|
* @param[in] window The window whose callback to set.
|
||||||
@ -1484,7 +1484,7 @@ GLFWAPI void glfwSetWindowFocusCallback(GLFWwindow window, GLFWwindowfocusfun cb
|
|||||||
*
|
*
|
||||||
* This callback is called when the window is iconified or restored.
|
* This callback is called when the window is iconified or restored.
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwSetWindowIconifyCallback(GLFWwindow window, GLFWwindowiconifyfun cbfun);
|
GLFWAPI void glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun cbfun);
|
||||||
|
|
||||||
/*! @brief Processes all pending events.
|
/*! @brief Processes all pending events.
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
@ -1514,7 +1514,7 @@ GLFWAPI void glfwWaitEvents(void);
|
|||||||
*
|
*
|
||||||
* @sa glfwSetInputMode
|
* @sa glfwSetInputMode
|
||||||
*/
|
*/
|
||||||
GLFWAPI int glfwGetInputMode(GLFWwindow window, int mode);
|
GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode);
|
||||||
|
|
||||||
/*! @brief Sets an input option for the specified window.
|
/*! @brief Sets an input option for the specified window.
|
||||||
* @param[in] mode One of the following:
|
* @param[in] mode One of the following:
|
||||||
@ -1525,7 +1525,7 @@ GLFWAPI int glfwGetInputMode(GLFWwindow window, int mode);
|
|||||||
*
|
*
|
||||||
* @sa glfwGetInputMode
|
* @sa glfwGetInputMode
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwSetInputMode(GLFWwindow window, int mode, int value);
|
GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value);
|
||||||
|
|
||||||
/*! @brief Returns the last reported state of a keyboard key for the specified
|
/*! @brief Returns the last reported state of a keyboard key for the specified
|
||||||
* window.
|
* window.
|
||||||
@ -1534,7 +1534,7 @@ GLFWAPI void glfwSetInputMode(GLFWwindow window, int mode, int value);
|
|||||||
* @return @ref GLFW_PRESS or @ref GLFW_RELEASE.
|
* @return @ref GLFW_PRESS or @ref GLFW_RELEASE.
|
||||||
* @ingroup input
|
* @ingroup input
|
||||||
*/
|
*/
|
||||||
GLFWAPI int glfwGetKey(GLFWwindow window, int key);
|
GLFWAPI int glfwGetKey(GLFWwindow* window, int key);
|
||||||
|
|
||||||
/*! @brief Returns the last reported state of a mouse button for the specified
|
/*! @brief Returns the last reported state of a mouse button for the specified
|
||||||
* window.
|
* window.
|
||||||
@ -1543,7 +1543,7 @@ GLFWAPI int glfwGetKey(GLFWwindow window, int key);
|
|||||||
* @return @ref GLFW_PRESS or @ref GLFW_RELEASE.
|
* @return @ref GLFW_PRESS or @ref GLFW_RELEASE.
|
||||||
* @ingroup input
|
* @ingroup input
|
||||||
*/
|
*/
|
||||||
GLFWAPI int glfwGetMouseButton(GLFWwindow window, int button);
|
GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);
|
||||||
|
|
||||||
/*! @brief Retrieves the last reported cursor position, relative to the client
|
/*! @brief Retrieves the last reported cursor position, relative to the client
|
||||||
* area of the window.
|
* area of the window.
|
||||||
@ -1556,7 +1556,7 @@ GLFWAPI int glfwGetMouseButton(GLFWwindow window, int button);
|
|||||||
*
|
*
|
||||||
* @sa glfwSetCursorPos
|
* @sa glfwSetCursorPos
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwGetCursorPos(GLFWwindow window, int* xpos, int* ypos);
|
GLFWAPI void glfwGetCursorPos(GLFWwindow* window, int* xpos, int* ypos);
|
||||||
|
|
||||||
/*! @brief Sets the position of the cursor, relative to the client area of the window.
|
/*! @brief Sets the position of the cursor, relative to the client area of the window.
|
||||||
* @param[in] window The desired window.
|
* @param[in] window The desired window.
|
||||||
@ -1570,11 +1570,11 @@ GLFWAPI void glfwGetCursorPos(GLFWwindow window, int* xpos, int* ypos);
|
|||||||
*
|
*
|
||||||
* @sa glfwGetCursorPos
|
* @sa glfwGetCursorPos
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwSetCursorPos(GLFWwindow window, int xpos, int ypos);
|
GLFWAPI void glfwSetCursorPos(GLFWwindow* window, int xpos, int ypos);
|
||||||
|
|
||||||
/*! @ingroup input
|
/*! @ingroup input
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwGetScrollOffset(GLFWwindow window, double* xoffset, double* yoffset);
|
GLFWAPI void glfwGetScrollOffset(GLFWwindow* window, double* xoffset, double* yoffset);
|
||||||
|
|
||||||
/*! @brief Sets the key callback.
|
/*! @brief Sets the key callback.
|
||||||
* @param[in] cbfun The new key callback, or @c NULL to remove the currently
|
* @param[in] cbfun The new key callback, or @c NULL to remove the currently
|
||||||
@ -1585,7 +1585,7 @@ GLFWAPI void glfwGetScrollOffset(GLFWwindow window, double* xoffset, double* yof
|
|||||||
* @endlink named after their use on the standard US keyboard layout. If you
|
* @endlink named after their use on the standard US keyboard layout. If you
|
||||||
* want to input text, use the Unicode character callback instead.
|
* want to input text, use the Unicode character callback instead.
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwSetKeyCallback(GLFWwindow window, GLFWkeyfun cbfun);
|
GLFWAPI void glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun);
|
||||||
|
|
||||||
/*! @brief Sets the Unicode character callback.
|
/*! @brief Sets the Unicode character callback.
|
||||||
* @param[in] cbfun The new Unicode character callback, or @c NULL to remove
|
* @param[in] cbfun The new Unicode character callback, or @c NULL to remove
|
||||||
@ -1595,14 +1595,14 @@ GLFWAPI void glfwSetKeyCallback(GLFWwindow window, GLFWkeyfun cbfun);
|
|||||||
* @remarks The Unicode character callback is for text input. If you want to
|
* @remarks The Unicode character callback is for text input. If you want to
|
||||||
* know whether a specific key was pressed or released, use the key callback.
|
* know whether a specific key was pressed or released, use the key callback.
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwSetCharCallback(GLFWwindow window, GLFWcharfun cbfun);
|
GLFWAPI void glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun);
|
||||||
|
|
||||||
/*! @brief Sets the mouse button callback.
|
/*! @brief Sets the mouse button callback.
|
||||||
* @param[in] cbfun The new mouse button callback, or @c NULL to remove the
|
* @param[in] cbfun The new mouse button callback, or @c NULL to remove the
|
||||||
* currently set callback.
|
* currently set callback.
|
||||||
* @ingroup input
|
* @ingroup input
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwSetMouseButtonCallback(GLFWwindow window, GLFWmousebuttonfun cbfun);
|
GLFWAPI void glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun cbfun);
|
||||||
|
|
||||||
/*! @brief Sets the cursor position callback.
|
/*! @brief Sets the cursor position callback.
|
||||||
* @param[in] cbfun The new cursor position callback, or @c NULL to remove the
|
* @param[in] cbfun The new cursor position callback, or @c NULL to remove the
|
||||||
@ -1612,14 +1612,14 @@ GLFWAPI void glfwSetMouseButtonCallback(GLFWwindow window, GLFWmousebuttonfun cb
|
|||||||
* @remarks The position is relative to the upper-left corner of the client
|
* @remarks The position is relative to the upper-left corner of the client
|
||||||
* area of the window.
|
* area of the window.
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwSetCursorPosCallback(GLFWwindow window, GLFWcursorposfun cbfun);
|
GLFWAPI void glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun cbfun);
|
||||||
|
|
||||||
/*! @brief Sets the cursor enter/exit callback.
|
/*! @brief Sets the cursor enter/exit callback.
|
||||||
* @param[in] cbfun The new cursor enter/exit callback, or @c NULL to remove
|
* @param[in] cbfun The new cursor enter/exit callback, or @c NULL to remove
|
||||||
* the currently set callback.
|
* the currently set callback.
|
||||||
* @ingroup input
|
* @ingroup input
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwSetCursorEnterCallback(GLFWwindow window, GLFWcursorenterfun cbfun);
|
GLFWAPI void glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun cbfun);
|
||||||
|
|
||||||
/*! @brief Sets the scroll callback.
|
/*! @brief Sets the scroll callback.
|
||||||
* @param[in] cbfun The new scroll callback, or @c NULL to remove the currently
|
* @param[in] cbfun The new scroll callback, or @c NULL to remove the currently
|
||||||
@ -1629,7 +1629,7 @@ GLFWAPI void glfwSetCursorEnterCallback(GLFWwindow window, GLFWcursorenterfun cb
|
|||||||
* @note This receives all scrolling input, like that from a mouse wheel or
|
* @note This receives all scrolling input, like that from a mouse wheel or
|
||||||
* a touchpad scrolling area.
|
* a touchpad scrolling area.
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwSetScrollCallback(GLFWwindow window, GLFWscrollfun cbfun);
|
GLFWAPI void glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun cbfun);
|
||||||
|
|
||||||
/*! @brief Returns a property of the specified joystick.
|
/*! @brief Returns a property of the specified joystick.
|
||||||
* @param[in] joy The joystick to query.
|
* @param[in] joy The joystick to query.
|
||||||
@ -1678,7 +1678,7 @@ GLFWAPI const char* glfwGetJoystickName(int joy);
|
|||||||
*
|
*
|
||||||
* @sa glfwGetClipboardString
|
* @sa glfwGetClipboardString
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwSetClipboardString(GLFWwindow window, const char* string);
|
GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string);
|
||||||
|
|
||||||
/*! @brief Retrieves the contents of the clipboard as a string.
|
/*! @brief Retrieves the contents of the clipboard as a string.
|
||||||
* @param[in] window The window that will request the clipboard contents.
|
* @param[in] window The window that will request the clipboard contents.
|
||||||
@ -1693,7 +1693,7 @@ GLFWAPI void glfwSetClipboardString(GLFWwindow window, const char* string);
|
|||||||
*
|
*
|
||||||
* @sa glfwSetClipboardString
|
* @sa glfwSetClipboardString
|
||||||
*/
|
*/
|
||||||
GLFWAPI const char* glfwGetClipboardString(GLFWwindow window);
|
GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window);
|
||||||
|
|
||||||
/*! @brief Retrieves the current value of the GLFW timer.
|
/*! @brief Retrieves the current value of the GLFW timer.
|
||||||
* @return The current value, in seconds.
|
* @return The current value, in seconds.
|
||||||
@ -1727,7 +1727,7 @@ GLFWAPI void glfwSetTime(double time);
|
|||||||
*
|
*
|
||||||
* @sa glfwGetCurrentContext
|
* @sa glfwGetCurrentContext
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwMakeContextCurrent(GLFWwindow window);
|
GLFWAPI void glfwMakeContextCurrent(GLFWwindow* window);
|
||||||
|
|
||||||
/*! @brief Returns the window whose context is current on this thread.
|
/*! @brief Returns the window whose context is current on this thread.
|
||||||
* @return The window whose context is current, or @c NULL if no window's
|
* @return The window whose context is current, or @c NULL if no window's
|
||||||
@ -1738,7 +1738,7 @@ GLFWAPI void glfwMakeContextCurrent(GLFWwindow window);
|
|||||||
*
|
*
|
||||||
* @sa glfwMakeContextCurrent
|
* @sa glfwMakeContextCurrent
|
||||||
*/
|
*/
|
||||||
GLFWAPI GLFWwindow glfwGetCurrentContext(void);
|
GLFWAPI GLFWwindow* glfwGetCurrentContext(void);
|
||||||
|
|
||||||
/*! @brief Swaps the front and back buffers of the specified window.
|
/*! @brief Swaps the front and back buffers of the specified window.
|
||||||
* @param[in] The window whose buffers to swap.
|
* @param[in] The window whose buffers to swap.
|
||||||
@ -1748,7 +1748,7 @@ GLFWAPI GLFWwindow glfwGetCurrentContext(void);
|
|||||||
*
|
*
|
||||||
* @sa glfwSwapInterval
|
* @sa glfwSwapInterval
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwSwapBuffers(GLFWwindow window);
|
GLFWAPI void glfwSwapBuffers(GLFWwindow* window);
|
||||||
|
|
||||||
/*! @brief Sets the swap interval for the current context.
|
/*! @brief Sets the swap interval for the current context.
|
||||||
* @param[in] interval The minimum number of video frame periods to wait for
|
* @param[in] interval The minimum number of video frame periods to wait for
|
||||||
|
@ -947,9 +947,10 @@ their skills. Special thanks go out to:</p>
|
|||||||
Leopard</li>
|
Leopard</li>
|
||||||
|
|
||||||
<li>Riku Salminen, for the initial implementation of
|
<li>Riku Salminen, for the initial implementation of
|
||||||
<code>glfwShowWindow</code> and <code>glfwHideWindow</code>, for the idea of
|
<code>glfwShowWindow</code> and <code>glfwHideWindow</code>, for the ideas of
|
||||||
<code>glfwDefaultWindowHints</code> and for making the X11 event processing
|
<code>glfwDefaultWindowHints</code> and making the pointer-ness of object
|
||||||
able to support multi-threaded rendering</li>
|
handles explicit, and for making the X11 event processing able to support
|
||||||
|
multi-threaded rendering</li>
|
||||||
|
|
||||||
<li>Douglas C. Schmidt and Irfan Pyarali, for their excellent article
|
<li>Douglas C. Schmidt and Irfan Pyarali, for their excellent article
|
||||||
<a href="http://www.cs.wustl.edu/~schmidt/win32-cv-1.html">Strategies for Implementing POSIX Condition Variables on Win32</a></li>
|
<a href="http://www.cs.wustl.edu/~schmidt/win32-cv-1.html">Strategies for Implementing POSIX Condition Variables on Win32</a></li>
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
// Set the clipboard contents
|
// Set the clipboard contents
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI void glfwSetClipboardString(GLFWwindow handle, const char* string)
|
GLFWAPI void glfwSetClipboardString(GLFWwindow* handle, const char* string)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ GLFWAPI void glfwSetClipboardString(GLFWwindow handle, const char* string)
|
|||||||
// Return the current clipboard contents
|
// Return the current clipboard contents
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI const char* glfwGetClipboardString(GLFWwindow handle)
|
GLFWAPI const char* glfwGetClipboardString(GLFWwindow* handle)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
|
@ -547,7 +547,7 @@ int _glfwStringInExtensionString(const char* string,
|
|||||||
// Make the context associated with the specified window current
|
// Make the context associated with the specified window current
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI void glfwMakeContextCurrent(GLFWwindow handle)
|
GLFWAPI void glfwMakeContextCurrent(GLFWwindow* handle)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
@ -568,7 +568,7 @@ GLFWAPI void glfwMakeContextCurrent(GLFWwindow handle)
|
|||||||
// Returns the window whose context is current
|
// Returns the window whose context is current
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI GLFWwindow glfwGetCurrentContext(void)
|
GLFWAPI GLFWwindow* glfwGetCurrentContext(void)
|
||||||
{
|
{
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
@ -576,7 +576,7 @@ GLFWAPI GLFWwindow glfwGetCurrentContext(void)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _glfwPlatformGetCurrentContext();
|
return (GLFWwindow*) _glfwPlatformGetCurrentContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -584,7 +584,7 @@ GLFWAPI GLFWwindow glfwGetCurrentContext(void)
|
|||||||
// Swap buffers (double-buffering)
|
// Swap buffers (double-buffering)
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI void glfwSwapBuffers(GLFWwindow handle)
|
GLFWAPI void glfwSwapBuffers(GLFWwindow* handle)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ GLFWAPI void glfwTerminate(void)
|
|||||||
|
|
||||||
// Close all remaining windows
|
// Close all remaining windows
|
||||||
while (_glfw.windowListHead)
|
while (_glfw.windowListHead)
|
||||||
glfwDestroyWindow(_glfw.windowListHead);
|
glfwDestroyWindow((GLFWwindow*) _glfw.windowListHead);
|
||||||
|
|
||||||
_glfwDestroyMonitors();
|
_glfwDestroyMonitors();
|
||||||
|
|
||||||
|
38
src/input.c
38
src/input.c
@ -145,7 +145,7 @@ void _glfwInputKey(_GLFWwindow* window, int key, int action)
|
|||||||
|
|
||||||
// Call user callback function
|
// Call user callback function
|
||||||
if (window->keyCallback && !repeated)
|
if (window->keyCallback && !repeated)
|
||||||
window->keyCallback(window, key, action);
|
window->keyCallback((GLFWwindow*) window, key, action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ void _glfwInputChar(_GLFWwindow* window, int character)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (window->charCallback)
|
if (window->charCallback)
|
||||||
window->charCallback(window, character);
|
window->charCallback((GLFWwindow*) window, character);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -174,7 +174,7 @@ void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset)
|
|||||||
window->scrollY += yoffset;
|
window->scrollY += yoffset;
|
||||||
|
|
||||||
if (window->scrollCallback)
|
if (window->scrollCallback)
|
||||||
window->scrollCallback(window, xoffset, yoffset);
|
window->scrollCallback((GLFWwindow*) window, xoffset, yoffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ void _glfwInputMouseClick(_GLFWwindow* window, int button, int action)
|
|||||||
window->mouseButton[button] = (char) action;
|
window->mouseButton[button] = (char) action;
|
||||||
|
|
||||||
if (window->mouseButtonCallback)
|
if (window->mouseButtonCallback)
|
||||||
window->mouseButtonCallback(window, button, action);
|
window->mouseButtonCallback((GLFWwindow*) window, button, action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -223,7 +223,7 @@ void _glfwInputCursorMotion(_GLFWwindow* window, int x, int y)
|
|||||||
|
|
||||||
if (window->cursorPosCallback)
|
if (window->cursorPosCallback)
|
||||||
{
|
{
|
||||||
window->cursorPosCallback(window,
|
window->cursorPosCallback((GLFWwindow*) window,
|
||||||
window->cursorPosX,
|
window->cursorPosX,
|
||||||
window->cursorPosY);
|
window->cursorPosY);
|
||||||
}
|
}
|
||||||
@ -237,7 +237,7 @@ void _glfwInputCursorMotion(_GLFWwindow* window, int x, int y)
|
|||||||
void _glfwInputCursorEnter(_GLFWwindow* window, int entered)
|
void _glfwInputCursorEnter(_GLFWwindow* window, int entered)
|
||||||
{
|
{
|
||||||
if (window->cursorEnterCallback)
|
if (window->cursorEnterCallback)
|
||||||
window->cursorEnterCallback(window, entered);
|
window->cursorEnterCallback((GLFWwindow*) window, entered);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -249,7 +249,7 @@ void _glfwInputCursorEnter(_GLFWwindow* window, int entered)
|
|||||||
// Returns the specified input mode of the specified window
|
// Returns the specified input mode of the specified window
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI int glfwGetInputMode(GLFWwindow handle, int mode)
|
GLFWAPI int glfwGetInputMode(GLFWwindow* handle, int mode)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
@ -278,7 +278,7 @@ GLFWAPI int glfwGetInputMode(GLFWwindow handle, int mode)
|
|||||||
// Sets the specified input mode of the specified window
|
// Sets the specified input mode of the specified window
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI void glfwSetInputMode(GLFWwindow handle, int mode, int value)
|
GLFWAPI void glfwSetInputMode(GLFWwindow* handle, int mode, int value)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
@ -310,7 +310,7 @@ GLFWAPI void glfwSetInputMode(GLFWwindow handle, int mode, int value)
|
|||||||
// 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 handle, int key)
|
GLFWAPI int glfwGetKey(GLFWwindow* handle, int key)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
@ -341,7 +341,7 @@ GLFWAPI int glfwGetKey(GLFWwindow handle, 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 handle, int button)
|
GLFWAPI int glfwGetMouseButton(GLFWwindow* handle, int button)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
@ -373,7 +373,7 @@ GLFWAPI int glfwGetMouseButton(GLFWwindow handle, int button)
|
|||||||
// Returns the last reported cursor position for the specified window
|
// Returns the last reported cursor position for the specified window
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI void glfwGetCursorPos(GLFWwindow handle, int* xpos, int* ypos)
|
GLFWAPI void glfwGetCursorPos(GLFWwindow* handle, int* xpos, int* ypos)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
@ -396,7 +396,7 @@ GLFWAPI void glfwGetCursorPos(GLFWwindow handle, int* xpos, int* ypos)
|
|||||||
// the specified window
|
// the specified window
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI void glfwSetCursorPos(GLFWwindow handle, int xpos, int ypos)
|
GLFWAPI void glfwSetCursorPos(GLFWwindow* handle, int xpos, int ypos)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
@ -430,7 +430,7 @@ GLFWAPI void glfwSetCursorPos(GLFWwindow handle, int xpos, int ypos)
|
|||||||
// Returns the scroll offset for the specified window
|
// Returns the scroll offset for the specified window
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI void glfwGetScrollOffset(GLFWwindow handle, double* xoffset, double* yoffset)
|
GLFWAPI void glfwGetScrollOffset(GLFWwindow* handle, double* xoffset, double* yoffset)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
@ -452,7 +452,7 @@ GLFWAPI void glfwGetScrollOffset(GLFWwindow handle, double* xoffset, double* yof
|
|||||||
// Set callback function for keyboard input
|
// Set callback function for keyboard input
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI void glfwSetKeyCallback(GLFWwindow handle, GLFWkeyfun cbfun)
|
GLFWAPI void glfwSetKeyCallback(GLFWwindow* handle, GLFWkeyfun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
@ -470,7 +470,7 @@ GLFWAPI void glfwSetKeyCallback(GLFWwindow handle, GLFWkeyfun cbfun)
|
|||||||
// Set callback function for character input
|
// Set callback function for character input
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI void glfwSetCharCallback(GLFWwindow handle, GLFWcharfun cbfun)
|
GLFWAPI void glfwSetCharCallback(GLFWwindow* handle, GLFWcharfun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
@ -488,7 +488,7 @@ GLFWAPI void glfwSetCharCallback(GLFWwindow handle, GLFWcharfun cbfun)
|
|||||||
// Set callback function for mouse clicks
|
// Set callback function for mouse clicks
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI void glfwSetMouseButtonCallback(GLFWwindow handle, GLFWmousebuttonfun cbfun)
|
GLFWAPI void glfwSetMouseButtonCallback(GLFWwindow* handle, GLFWmousebuttonfun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
@ -506,7 +506,7 @@ GLFWAPI void glfwSetMouseButtonCallback(GLFWwindow handle, GLFWmousebuttonfun cb
|
|||||||
// Set callback function for mouse moves
|
// Set callback function for mouse moves
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI void glfwSetCursorPosCallback(GLFWwindow handle, GLFWcursorposfun cbfun)
|
GLFWAPI void glfwSetCursorPosCallback(GLFWwindow* handle, GLFWcursorposfun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
@ -524,7 +524,7 @@ GLFWAPI void glfwSetCursorPosCallback(GLFWwindow handle, GLFWcursorposfun cbfun)
|
|||||||
// Set callback function for cursor enter/leave events
|
// Set callback function for cursor enter/leave events
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI void glfwSetCursorEnterCallback(GLFWwindow handle, GLFWcursorenterfun cbfun)
|
GLFWAPI void glfwSetCursorEnterCallback(GLFWwindow* handle, GLFWcursorenterfun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
@ -542,7 +542,7 @@ GLFWAPI void glfwSetCursorEnterCallback(GLFWwindow handle, GLFWcursorenterfun cb
|
|||||||
// Set callback function for scroll events
|
// Set callback function for scroll events
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI void glfwSetScrollCallback(GLFWwindow handle, GLFWscrollfun cbfun)
|
GLFWAPI void glfwSetScrollCallback(GLFWwindow* handle, GLFWscrollfun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ void _glfwInputMonitorChange(void)
|
|||||||
if (j == _glfw.monitorCount)
|
if (j == _glfw.monitorCount)
|
||||||
{
|
{
|
||||||
// This monitor was not connected before
|
// This monitor was not connected before
|
||||||
_glfw.monitorCallback(monitors[i], GLFW_CONNECTED);
|
_glfw.monitorCallback((GLFWmonitor*) monitors[i], GLFW_CONNECTED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ void _glfwInputMonitorChange(void)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// This monitor is no longer connected
|
// This monitor is no longer connected
|
||||||
_glfw.monitorCallback(_glfw.monitors[i], GLFW_DISCONNECTED);
|
_glfw.monitorCallback((GLFWmonitor*) _glfw.monitors[i], GLFW_DISCONNECTED);
|
||||||
|
|
||||||
for (window = _glfw.windowListHead; window; window = window->next)
|
for (window = _glfw.windowListHead; window; window = window->next)
|
||||||
{
|
{
|
||||||
@ -304,7 +304,7 @@ void _glfwSplitBPP(int bpp, int* red, int* green, int* blue)
|
|||||||
// Return the currently connected monitors
|
// Return the currently connected monitors
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI const GLFWmonitor* glfwGetMonitors(int* count)
|
GLFWAPI GLFWmonitor** glfwGetMonitors(int* count)
|
||||||
{
|
{
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
@ -319,7 +319,7 @@ GLFWAPI const GLFWmonitor* glfwGetMonitors(int* count)
|
|||||||
}
|
}
|
||||||
|
|
||||||
*count = _glfw.monitorCount;
|
*count = _glfw.monitorCount;
|
||||||
return (GLFWmonitor*) _glfw.monitors;
|
return (GLFWmonitor**) _glfw.monitors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -327,10 +327,10 @@ GLFWAPI const GLFWmonitor* glfwGetMonitors(int* count)
|
|||||||
// Get the primary monitor
|
// Get the primary monitor
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI GLFWmonitor glfwGetPrimaryMonitor(void)
|
GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
GLFWmonitor handle = NULL;
|
_GLFWmonitor* primary = NULL;
|
||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
@ -342,18 +342,18 @@ GLFWAPI GLFWmonitor glfwGetPrimaryMonitor(void)
|
|||||||
{
|
{
|
||||||
if (_glfw.monitors[i]->primary)
|
if (_glfw.monitors[i]->primary)
|
||||||
{
|
{
|
||||||
handle = _glfw.monitors[i];
|
primary = _glfw.monitors[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!handle)
|
if (!primary)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR, NULL);
|
_glfwInputError(GLFW_PLATFORM_ERROR, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return handle;
|
return (GLFWmonitor*) primary;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -361,7 +361,7 @@ GLFWAPI GLFWmonitor glfwGetPrimaryMonitor(void)
|
|||||||
// Get monitor parameter
|
// Get monitor parameter
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI int glfwGetMonitorParam(GLFWmonitor handle, int param)
|
GLFWAPI int glfwGetMonitorParam(GLFWmonitor* handle, int param)
|
||||||
{
|
{
|
||||||
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||||
|
|
||||||
@ -400,7 +400,7 @@ GLFWAPI int glfwGetMonitorParam(GLFWmonitor handle, int param)
|
|||||||
// Get monitor string
|
// Get monitor string
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI const char* glfwGetMonitorName(GLFWmonitor handle)
|
GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* handle)
|
||||||
{
|
{
|
||||||
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||||
|
|
||||||
@ -441,7 +441,7 @@ GLFWAPI void glfwSetMonitorCallback(GLFWmonitorfun cbfun)
|
|||||||
// Get a list of available video modes
|
// Get a list of available video modes
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor handle, int* count)
|
GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* handle, int* count)
|
||||||
{
|
{
|
||||||
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||||
|
|
||||||
@ -476,7 +476,7 @@ GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor handle, int* count)
|
|||||||
// Get the current video mode for the specified monitor
|
// Get the current video mode for the specified monitor
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI void glfwGetVideoMode(GLFWmonitor handle, GLFWvidmode* mode)
|
GLFWAPI void glfwGetVideoMode(GLFWmonitor* handle, GLFWvidmode* mode)
|
||||||
{
|
{
|
||||||
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||||
|
|
||||||
|
84
src/window.c
84
src/window.c
@ -81,7 +81,7 @@ void _glfwInputWindowFocus(_GLFWwindow* window, GLboolean focused)
|
|||||||
_glfw.focusedWindow = window;
|
_glfw.focusedWindow = window;
|
||||||
|
|
||||||
if (window->windowFocusCallback)
|
if (window->windowFocusCallback)
|
||||||
window->windowFocusCallback(window, focused);
|
window->windowFocusCallback((GLFWwindow*) window, focused);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -107,7 +107,7 @@ void _glfwInputWindowFocus(_GLFWwindow* window, GLboolean focused)
|
|||||||
_glfw.focusedWindow = NULL;
|
_glfw.focusedWindow = NULL;
|
||||||
|
|
||||||
if (window->windowFocusCallback)
|
if (window->windowFocusCallback)
|
||||||
window->windowFocusCallback(window, focused);
|
window->windowFocusCallback((GLFWwindow*) window, focused);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -126,7 +126,7 @@ void _glfwInputWindowPos(_GLFWwindow* window, int x, int y)
|
|||||||
window->positionY = y;
|
window->positionY = y;
|
||||||
|
|
||||||
if (window->windowPosCallback)
|
if (window->windowPosCallback)
|
||||||
window->windowPosCallback(window, x, y);
|
window->windowPosCallback((GLFWwindow*) window, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -143,7 +143,7 @@ void _glfwInputWindowSize(_GLFWwindow* window, int width, int height)
|
|||||||
window->height = height;
|
window->height = height;
|
||||||
|
|
||||||
if (window->windowSizeCallback)
|
if (window->windowSizeCallback)
|
||||||
window->windowSizeCallback(window, width, height);
|
window->windowSizeCallback((GLFWwindow*) window, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ void _glfwInputWindowIconify(_GLFWwindow* window, int iconified)
|
|||||||
window->iconified = iconified;
|
window->iconified = iconified;
|
||||||
|
|
||||||
if (window->windowIconifyCallback)
|
if (window->windowIconifyCallback)
|
||||||
window->windowIconifyCallback(window, iconified);
|
window->windowIconifyCallback((GLFWwindow*) window, iconified);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ void _glfwInputWindowVisibility(_GLFWwindow* window, int visible)
|
|||||||
void _glfwInputWindowDamage(_GLFWwindow* window)
|
void _glfwInputWindowDamage(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
if (window->windowRefreshCallback)
|
if (window->windowRefreshCallback)
|
||||||
window->windowRefreshCallback(window);
|
window->windowRefreshCallback((GLFWwindow*) window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -191,7 +191,7 @@ void _glfwInputWindowDamage(_GLFWwindow* window)
|
|||||||
void _glfwInputWindowCloseRequest(_GLFWwindow* window)
|
void _glfwInputWindowCloseRequest(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
if (window->windowCloseCallback)
|
if (window->windowCloseCallback)
|
||||||
window->closeRequested = window->windowCloseCallback(window);
|
window->closeRequested = window->windowCloseCallback((GLFWwindow*) window);
|
||||||
else
|
else
|
||||||
window->closeRequested = GL_TRUE;
|
window->closeRequested = GL_TRUE;
|
||||||
}
|
}
|
||||||
@ -205,10 +205,10 @@ void _glfwInputWindowCloseRequest(_GLFWwindow* window)
|
|||||||
// Create the GLFW window and its associated context
|
// Create the GLFW window and its associated context
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
|
GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
|
||||||
const char* title,
|
const char* title,
|
||||||
GLFWmonitor monitor,
|
GLFWmonitor* monitor,
|
||||||
GLFWwindow share)
|
GLFWwindow* share)
|
||||||
{
|
{
|
||||||
_GLFWfbconfig fbconfig;
|
_GLFWfbconfig fbconfig;
|
||||||
_GLFWwndconfig wndconfig;
|
_GLFWwndconfig wndconfig;
|
||||||
@ -290,31 +290,31 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Save the currently current context so it can be restored later
|
// Save the currently current context so it can be restored later
|
||||||
previous = glfwGetCurrentContext();
|
previous = (_GLFWwindow*) glfwGetCurrentContext();
|
||||||
|
|
||||||
// Open the actual window and create its context
|
// Open the actual window and create its context
|
||||||
if (!_glfwPlatformCreateWindow(window, &wndconfig, &fbconfig))
|
if (!_glfwPlatformCreateWindow(window, &wndconfig, &fbconfig))
|
||||||
{
|
{
|
||||||
glfwDestroyWindow(window);
|
glfwDestroyWindow((GLFWwindow*) window);
|
||||||
glfwMakeContextCurrent(previous);
|
glfwMakeContextCurrent((GLFWwindow*) previous);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
glfwMakeContextCurrent(window);
|
glfwMakeContextCurrent((GLFWwindow*) window);
|
||||||
|
|
||||||
// Cache the actual (as opposed to requested) context parameters
|
// Cache the actual (as opposed to requested) context parameters
|
||||||
if (!_glfwRefreshContextParams())
|
if (!_glfwRefreshContextParams())
|
||||||
{
|
{
|
||||||
glfwDestroyWindow(window);
|
glfwDestroyWindow((GLFWwindow*) window);
|
||||||
glfwMakeContextCurrent(previous);
|
glfwMakeContextCurrent((GLFWwindow*) previous);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify the context against the requested parameters
|
// Verify the context against the requested parameters
|
||||||
if (!_glfwIsValidContext(&wndconfig))
|
if (!_glfwIsValidContext(&wndconfig))
|
||||||
{
|
{
|
||||||
glfwDestroyWindow(window);
|
glfwDestroyWindow((GLFWwindow*) window);
|
||||||
glfwMakeContextCurrent(previous);
|
glfwMakeContextCurrent((GLFWwindow*) previous);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,17 +324,17 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
|
|||||||
_glfwPlatformSwapBuffers(window);
|
_glfwPlatformSwapBuffers(window);
|
||||||
|
|
||||||
// Restore the previously current context (or NULL)
|
// Restore the previously current context (or NULL)
|
||||||
glfwMakeContextCurrent(previous);
|
glfwMakeContextCurrent((GLFWwindow*) previous);
|
||||||
|
|
||||||
// The GLFW specification states that fullscreen windows have the cursor
|
// The GLFW specification states that fullscreen windows have the cursor
|
||||||
// captured by default
|
// captured by default
|
||||||
if (wndconfig.monitor)
|
if (wndconfig.monitor)
|
||||||
glfwSetInputMode(window, GLFW_CURSOR_MODE, GLFW_CURSOR_CAPTURED);
|
glfwSetInputMode((GLFWwindow*) window, GLFW_CURSOR_MODE, GLFW_CURSOR_CAPTURED);
|
||||||
|
|
||||||
if (wndconfig.monitor == NULL && wndconfig.visible)
|
if (wndconfig.monitor == NULL && wndconfig.visible)
|
||||||
glfwShowWindow(window);
|
glfwShowWindow((GLFWwindow*) window);
|
||||||
|
|
||||||
return window;
|
return (GLFWwindow*) window;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -474,7 +474,7 @@ GLFWAPI void glfwWindowHint(int target, int hint)
|
|||||||
// Properly kill the window / video display
|
// Properly kill the window / video display
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI void glfwDestroyWindow(GLFWwindow handle)
|
GLFWAPI void glfwDestroyWindow(GLFWwindow* handle)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
@ -531,7 +531,7 @@ GLFWAPI void glfwDestroyWindow(GLFWwindow handle)
|
|||||||
// Set the window title
|
// Set the window title
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI void glfwSetWindowTitle(GLFWwindow handle, const char* title)
|
GLFWAPI void glfwSetWindowTitle(GLFWwindow* handle, const char* title)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
@ -549,7 +549,7 @@ GLFWAPI void glfwSetWindowTitle(GLFWwindow handle, const char* title)
|
|||||||
// Get the window size
|
// Get the window size
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI void glfwGetWindowSize(GLFWwindow handle, int* width, int* height)
|
GLFWAPI void glfwGetWindowSize(GLFWwindow* handle, int* width, int* height)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
@ -571,7 +571,7 @@ GLFWAPI void glfwGetWindowSize(GLFWwindow handle, int* width, int* height)
|
|||||||
// Set the window size
|
// Set the window size
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI void glfwSetWindowSize(GLFWwindow handle, int width, int height)
|
GLFWAPI void glfwSetWindowSize(GLFWwindow* handle, int width, int height)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
@ -599,7 +599,7 @@ GLFWAPI void glfwSetWindowSize(GLFWwindow handle, int width, int height)
|
|||||||
// Window iconification
|
// Window iconification
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI void glfwIconifyWindow(GLFWwindow handle)
|
GLFWAPI void glfwIconifyWindow(GLFWwindow* handle)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
@ -620,7 +620,7 @@ GLFWAPI void glfwIconifyWindow(GLFWwindow handle)
|
|||||||
// Window un-iconification
|
// Window un-iconification
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI void glfwRestoreWindow(GLFWwindow handle)
|
GLFWAPI void glfwRestoreWindow(GLFWwindow* handle)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
@ -641,7 +641,7 @@ GLFWAPI void glfwRestoreWindow(GLFWwindow handle)
|
|||||||
// Window show
|
// Window show
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI void glfwShowWindow(GLFWwindow handle)
|
GLFWAPI void glfwShowWindow(GLFWwindow* handle)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
@ -662,7 +662,7 @@ GLFWAPI void glfwShowWindow(GLFWwindow handle)
|
|||||||
// Window hide
|
// Window hide
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI void glfwHideWindow(GLFWwindow handle)
|
GLFWAPI void glfwHideWindow(GLFWwindow* handle)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
@ -683,7 +683,7 @@ GLFWAPI void glfwHideWindow(GLFWwindow handle)
|
|||||||
// Get window parameter
|
// Get window parameter
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI int glfwGetWindowParam(GLFWwindow handle, int param)
|
GLFWAPI int glfwGetWindowParam(GLFWwindow* handle, int param)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
@ -736,7 +736,7 @@ GLFWAPI int glfwGetWindowParam(GLFWwindow handle, int param)
|
|||||||
// Get window monitor
|
// Get window monitor
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI GLFWmonitor glfwGetWindowMonitor(GLFWwindow handle)
|
GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* handle)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
@ -746,7 +746,7 @@ GLFWAPI GLFWmonitor glfwGetWindowMonitor(GLFWwindow handle)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (GLFWmonitor) window->monitor;
|
return (GLFWmonitor*) window->monitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -754,7 +754,7 @@ GLFWAPI GLFWmonitor glfwGetWindowMonitor(GLFWwindow handle)
|
|||||||
// Set the user pointer for the specified window
|
// Set the user pointer for the specified window
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI void glfwSetWindowUserPointer(GLFWwindow handle, void* pointer)
|
GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* handle, void* pointer)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
@ -772,7 +772,7 @@ GLFWAPI void glfwSetWindowUserPointer(GLFWwindow handle, void* pointer)
|
|||||||
// Get the user pointer for the specified window
|
// Get the user pointer for the specified window
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow handle)
|
GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* handle)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
@ -790,7 +790,7 @@ GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow handle)
|
|||||||
// Set callback function for window position changes
|
// Set callback function for window position changes
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI void glfwSetWindowPosCallback(GLFWwindow handle, GLFWwindowposfun cbfun)
|
GLFWAPI void glfwSetWindowPosCallback(GLFWwindow* handle, GLFWwindowposfun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
@ -808,7 +808,7 @@ GLFWAPI void glfwSetWindowPosCallback(GLFWwindow handle, GLFWwindowposfun cbfun)
|
|||||||
// Set callback function for window size changes
|
// Set callback function for window size changes
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI void glfwSetWindowSizeCallback(GLFWwindow handle, GLFWwindowsizefun cbfun)
|
GLFWAPI void glfwSetWindowSizeCallback(GLFWwindow* handle, GLFWwindowsizefun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
@ -826,7 +826,7 @@ GLFWAPI void glfwSetWindowSizeCallback(GLFWwindow handle, GLFWwindowsizefun cbfu
|
|||||||
// Set callback function for window close events
|
// Set callback function for window close events
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI void glfwSetWindowCloseCallback(GLFWwindow handle, GLFWwindowclosefun cbfun)
|
GLFWAPI void glfwSetWindowCloseCallback(GLFWwindow* handle, GLFWwindowclosefun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
@ -844,7 +844,7 @@ GLFWAPI void glfwSetWindowCloseCallback(GLFWwindow handle, GLFWwindowclosefun cb
|
|||||||
// Set callback function for window refresh events
|
// Set callback function for window refresh events
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI void glfwSetWindowRefreshCallback(GLFWwindow handle, GLFWwindowrefreshfun cbfun)
|
GLFWAPI void glfwSetWindowRefreshCallback(GLFWwindow* handle, GLFWwindowrefreshfun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
@ -862,7 +862,7 @@ GLFWAPI void glfwSetWindowRefreshCallback(GLFWwindow handle, GLFWwindowrefreshfu
|
|||||||
// Set callback function for window focus events
|
// Set callback function for window focus events
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI void glfwSetWindowFocusCallback(GLFWwindow handle, GLFWwindowfocusfun cbfun)
|
GLFWAPI void glfwSetWindowFocusCallback(GLFWwindow* handle, GLFWwindowfocusfun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
@ -880,7 +880,7 @@ GLFWAPI void glfwSetWindowFocusCallback(GLFWwindow handle, GLFWwindowfocusfun cb
|
|||||||
// Set callback function for window iconification events
|
// Set callback function for window iconification events
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI void glfwSetWindowIconifyCallback(GLFWwindow handle, GLFWwindowiconifyfun cbfun)
|
GLFWAPI void glfwSetWindowIconifyCallback(GLFWwindow* handle, GLFWwindowiconifyfun cbfun)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ static int cursor_x = 0, cursor_y = 0;
|
|||||||
static int window_width = 640, window_height = 480;
|
static int window_width = 640, window_height = 480;
|
||||||
static int swap_interval = 1;
|
static int swap_interval = 1;
|
||||||
|
|
||||||
static void set_swap_interval(GLFWwindow window, int interval)
|
static void set_swap_interval(GLFWwindow* window, int interval)
|
||||||
{
|
{
|
||||||
char title[256];
|
char title[256];
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ static void error_callback(int error, const char* description)
|
|||||||
fprintf(stderr, "Error: %s\n", description);
|
fprintf(stderr, "Error: %s\n", description);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void window_size_callback(GLFWwindow window, int width, int height)
|
static void window_size_callback(GLFWwindow* window, int width, int height)
|
||||||
{
|
{
|
||||||
window_width = width;
|
window_width = width;
|
||||||
window_height = height;
|
window_height = height;
|
||||||
@ -68,13 +68,13 @@ static void window_size_callback(GLFWwindow window, int width, int height)
|
|||||||
gluOrtho2D(0.f, window_width, 0.f, window_height);
|
gluOrtho2D(0.f, window_width, 0.f, window_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cursor_position_callback(GLFWwindow window, int x, int y)
|
static void cursor_position_callback(GLFWwindow* window, int x, int y)
|
||||||
{
|
{
|
||||||
cursor_x = x;
|
cursor_x = x;
|
||||||
cursor_y = y;
|
cursor_y = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void key_callback(GLFWwindow window, int key, int action)
|
static void key_callback(GLFWwindow* window, int key, int action)
|
||||||
{
|
{
|
||||||
if (key == GLFW_KEY_SPACE && action == GLFW_PRESS)
|
if (key == GLFW_KEY_SPACE && action == GLFW_PRESS)
|
||||||
set_swap_interval(window, 1 - swap_interval);
|
set_swap_interval(window, 1 - swap_interval);
|
||||||
@ -82,7 +82,7 @@ static void key_callback(GLFWwindow window, int key, int action)
|
|||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
GLFWwindow window;
|
GLFWwindow* window;
|
||||||
int width, height;
|
int width, height;
|
||||||
|
|
||||||
glfwSetErrorCallback(error_callback);
|
glfwSetErrorCallback(error_callback);
|
||||||
|
@ -41,7 +41,7 @@ static void usage(void)
|
|||||||
printf("Usage: clipboard [-h]\n");
|
printf("Usage: clipboard [-h]\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static GLboolean control_is_down(GLFWwindow window)
|
static GLboolean control_is_down(GLFWwindow* window)
|
||||||
{
|
{
|
||||||
return glfwGetKey(window, GLFW_KEY_LEFT_CONTROL) ||
|
return glfwGetKey(window, GLFW_KEY_LEFT_CONTROL) ||
|
||||||
glfwGetKey(window, GLFW_KEY_RIGHT_CONTROL);
|
glfwGetKey(window, GLFW_KEY_RIGHT_CONTROL);
|
||||||
@ -52,13 +52,13 @@ static void error_callback(int error, const char* description)
|
|||||||
fprintf(stderr, "Error: %s\n", description);
|
fprintf(stderr, "Error: %s\n", description);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int window_close_callback(GLFWwindow window)
|
static int window_close_callback(GLFWwindow* window)
|
||||||
{
|
{
|
||||||
closed = GL_TRUE;
|
closed = GL_TRUE;
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void key_callback(GLFWwindow window, int key, int action)
|
static void key_callback(GLFWwindow* window, int key, int action)
|
||||||
{
|
{
|
||||||
if (action != GLFW_PRESS)
|
if (action != GLFW_PRESS)
|
||||||
return;
|
return;
|
||||||
@ -93,7 +93,7 @@ static void key_callback(GLFWwindow window, int key, int action)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void window_size_callback(GLFWwindow window, int width, int height)
|
static void window_size_callback(GLFWwindow* window, int width, int height)
|
||||||
{
|
{
|
||||||
glViewport(0, 0, width, height);
|
glViewport(0, 0, width, height);
|
||||||
}
|
}
|
||||||
@ -101,7 +101,7 @@ static void window_size_callback(GLFWwindow window, int width, int height)
|
|||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
GLFWwindow window;
|
GLFWwindow* window;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "h")) != -1)
|
while ((ch = getopt(argc, argv, "h")) != -1)
|
||||||
{
|
{
|
||||||
|
@ -79,7 +79,7 @@ static void error_callback(int error, const char* description)
|
|||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
int i, width, height;
|
int i, width, height;
|
||||||
GLFWwindow window;
|
GLFWwindow* window;
|
||||||
|
|
||||||
glfwSetErrorCallback(error_callback);
|
glfwSetErrorCallback(error_callback);
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ static void error_callback(int error, const char* description)
|
|||||||
fprintf(stderr, "Error: %s\n", description);
|
fprintf(stderr, "Error: %s\n", description);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void window_pos_callback(GLFWwindow window, int x, int y)
|
static void window_pos_callback(GLFWwindow* window, int x, int y)
|
||||||
{
|
{
|
||||||
printf("%08x at %0.3f: Window position: %i %i\n",
|
printf("%08x at %0.3f: Window position: %i %i\n",
|
||||||
counter++,
|
counter++,
|
||||||
@ -232,7 +232,7 @@ static void window_pos_callback(GLFWwindow window, int x, int y)
|
|||||||
y);
|
y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void window_size_callback(GLFWwindow window, int width, int height)
|
static void window_size_callback(GLFWwindow* window, int width, int height)
|
||||||
{
|
{
|
||||||
printf("%08x at %0.3f: Window size: %i %i\n",
|
printf("%08x at %0.3f: Window size: %i %i\n",
|
||||||
counter++,
|
counter++,
|
||||||
@ -243,14 +243,14 @@ static void window_size_callback(GLFWwindow window, int width, int height)
|
|||||||
glViewport(0, 0, width, height);
|
glViewport(0, 0, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int window_close_callback(GLFWwindow window)
|
static int window_close_callback(GLFWwindow* window)
|
||||||
{
|
{
|
||||||
printf("%08x at %0.3f: Window close\n", counter++, glfwGetTime());
|
printf("%08x at %0.3f: Window close\n", counter++, glfwGetTime());
|
||||||
|
|
||||||
return closeable;
|
return closeable;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void window_refresh_callback(GLFWwindow window)
|
static void window_refresh_callback(GLFWwindow* window)
|
||||||
{
|
{
|
||||||
printf("%08x at %0.3f: Window refresh\n", counter++, glfwGetTime());
|
printf("%08x at %0.3f: Window refresh\n", counter++, glfwGetTime());
|
||||||
|
|
||||||
@ -261,7 +261,7 @@ static void window_refresh_callback(GLFWwindow window)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void window_focus_callback(GLFWwindow window, int focused)
|
static void window_focus_callback(GLFWwindow* window, int focused)
|
||||||
{
|
{
|
||||||
printf("%08x at %0.3f: Window %s\n",
|
printf("%08x at %0.3f: Window %s\n",
|
||||||
counter++,
|
counter++,
|
||||||
@ -269,7 +269,7 @@ static void window_focus_callback(GLFWwindow window, int focused)
|
|||||||
focused ? "focused" : "defocused");
|
focused ? "focused" : "defocused");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void window_iconify_callback(GLFWwindow window, int iconified)
|
static void window_iconify_callback(GLFWwindow* window, int iconified)
|
||||||
{
|
{
|
||||||
printf("%08x at %0.3f: Window was %s\n",
|
printf("%08x at %0.3f: Window was %s\n",
|
||||||
counter++,
|
counter++,
|
||||||
@ -277,7 +277,7 @@ static void window_iconify_callback(GLFWwindow window, int iconified)
|
|||||||
iconified ? "iconified" : "restored");
|
iconified ? "iconified" : "restored");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mouse_button_callback(GLFWwindow window, int button, int action)
|
static void mouse_button_callback(GLFWwindow* window, int button, int action)
|
||||||
{
|
{
|
||||||
const char* name = get_button_name(button);
|
const char* name = get_button_name(button);
|
||||||
|
|
||||||
@ -289,12 +289,12 @@ static void mouse_button_callback(GLFWwindow window, int button, int action)
|
|||||||
printf(" was %s\n", get_action_name(action));
|
printf(" was %s\n", get_action_name(action));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cursor_position_callback(GLFWwindow window, int x, int y)
|
static void cursor_position_callback(GLFWwindow* window, int x, int y)
|
||||||
{
|
{
|
||||||
printf("%08x at %0.3f: Cursor position: %i %i\n", counter++, glfwGetTime(), x, y);
|
printf("%08x at %0.3f: Cursor position: %i %i\n", counter++, glfwGetTime(), x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cursor_enter_callback(GLFWwindow window, int entered)
|
static void cursor_enter_callback(GLFWwindow* window, int entered)
|
||||||
{
|
{
|
||||||
printf("%08x at %0.3f: Cursor %s window\n",
|
printf("%08x at %0.3f: Cursor %s window\n",
|
||||||
counter++,
|
counter++,
|
||||||
@ -302,12 +302,12 @@ static void cursor_enter_callback(GLFWwindow window, int entered)
|
|||||||
entered ? "entered" : "left");
|
entered ? "entered" : "left");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void scroll_callback(GLFWwindow window, double x, double y)
|
static void scroll_callback(GLFWwindow* window, double x, double y)
|
||||||
{
|
{
|
||||||
printf("%08x at %0.3f: Scroll: %0.3f %0.3f\n", counter++, glfwGetTime(), x, y);
|
printf("%08x at %0.3f: Scroll: %0.3f %0.3f\n", counter++, glfwGetTime(), x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void key_callback(GLFWwindow window, int key, int action)
|
static void key_callback(GLFWwindow* window, int key, int action)
|
||||||
{
|
{
|
||||||
const char* name = get_key_name(key);
|
const char* name = get_key_name(key);
|
||||||
|
|
||||||
@ -333,7 +333,7 @@ static void key_callback(GLFWwindow window, int key, int action)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void char_callback(GLFWwindow window, int character)
|
static void char_callback(GLFWwindow* window, int character)
|
||||||
{
|
{
|
||||||
printf("%08x at %0.3f: Character 0x%04x (%s) input\n",
|
printf("%08x at %0.3f: Character 0x%04x (%s) input\n",
|
||||||
counter++,
|
counter++,
|
||||||
@ -342,7 +342,7 @@ static void char_callback(GLFWwindow window, int character)
|
|||||||
get_character_string(character));
|
get_character_string(character));
|
||||||
}
|
}
|
||||||
|
|
||||||
void monitor_callback(GLFWmonitor monitor, int event)
|
void monitor_callback(GLFWmonitor* monitor, int event)
|
||||||
{
|
{
|
||||||
if (event == GLFW_CONNECTED)
|
if (event == GLFW_CONNECTED)
|
||||||
{
|
{
|
||||||
@ -370,7 +370,7 @@ void monitor_callback(GLFWmonitor monitor, int event)
|
|||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
GLFWwindow window;
|
GLFWwindow* window;
|
||||||
int width, height;
|
int width, height;
|
||||||
|
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
|
@ -43,12 +43,12 @@ static void error_callback(int error, const char* description)
|
|||||||
fprintf(stderr, "Error: %s\n", description);
|
fprintf(stderr, "Error: %s\n", description);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void window_size_callback(GLFWwindow window, int width, int height)
|
static void window_size_callback(GLFWwindow* window, int width, int height)
|
||||||
{
|
{
|
||||||
glViewport(0, 0, width, height);
|
glViewport(0, 0, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void key_callback(GLFWwindow window, int key, int action)
|
static void key_callback(GLFWwindow* window, int key, int action)
|
||||||
{
|
{
|
||||||
if (action != GLFW_PRESS)
|
if (action != GLFW_PRESS)
|
||||||
return;
|
return;
|
||||||
@ -69,7 +69,7 @@ static void usage(void)
|
|||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
int ch, samples = 4;
|
int ch, samples = 4;
|
||||||
GLFWwindow window;
|
GLFWwindow* window;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "hs:")) != -1)
|
while ((ch = getopt(argc, argv, "hs:")) != -1)
|
||||||
{
|
{
|
||||||
|
@ -40,14 +40,14 @@ static void error_callback(int error, const char* description)
|
|||||||
fprintf(stderr, "Error: %s\n", description);
|
fprintf(stderr, "Error: %s\n", description);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void window_focus_callback(GLFWwindow window, int focused)
|
static void window_focus_callback(GLFWwindow* window, int focused)
|
||||||
{
|
{
|
||||||
printf("%0.3f: Window %s\n",
|
printf("%0.3f: Window %s\n",
|
||||||
glfwGetTime(),
|
glfwGetTime(),
|
||||||
focused ? "focused" : "defocused");
|
focused ? "focused" : "defocused");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void window_key_callback(GLFWwindow window, int key, int action)
|
static void window_key_callback(GLFWwindow* window, int key, int action)
|
||||||
{
|
{
|
||||||
if (action != GLFW_PRESS)
|
if (action != GLFW_PRESS)
|
||||||
return;
|
return;
|
||||||
@ -70,7 +70,7 @@ static void window_key_callback(GLFWwindow window, int key, int action)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int window_close_callback(GLFWwindow window)
|
static int window_close_callback(GLFWwindow* window)
|
||||||
{
|
{
|
||||||
printf("%0.3f: User closed window\n", glfwGetTime());
|
printf("%0.3f: User closed window\n", glfwGetTime());
|
||||||
running = GL_FALSE;
|
running = GL_FALSE;
|
||||||
@ -79,7 +79,7 @@ static int window_close_callback(GLFWwindow window)
|
|||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
GLFWwindow window;
|
GLFWwindow* window;
|
||||||
|
|
||||||
glfwSetErrorCallback(error_callback);
|
glfwSetErrorCallback(error_callback);
|
||||||
|
|
||||||
|
@ -57,13 +57,13 @@ static void error_callback(int error, const char* description)
|
|||||||
fprintf(stderr, "Error: %s\n", description);
|
fprintf(stderr, "Error: %s\n", description);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int window_close_callback(GLFWwindow window)
|
static int window_close_callback(GLFWwindow* window)
|
||||||
{
|
{
|
||||||
closed = GL_TRUE;
|
closed = GL_TRUE;
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void key_callback(GLFWwindow window, int key, int action)
|
static void key_callback(GLFWwindow* window, int key, int action)
|
||||||
{
|
{
|
||||||
if (action != GLFW_PRESS)
|
if (action != GLFW_PRESS)
|
||||||
return;
|
return;
|
||||||
@ -94,7 +94,7 @@ static void key_callback(GLFWwindow window, int key, int action)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void size_callback(GLFWwindow window, int width, int height)
|
static void size_callback(GLFWwindow* window, int width, int height)
|
||||||
{
|
{
|
||||||
glViewport(0, 0, width, height);
|
glViewport(0, 0, width, height);
|
||||||
}
|
}
|
||||||
@ -102,8 +102,8 @@ static void size_callback(GLFWwindow window, int width, int height)
|
|||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
int width, height, ch;
|
int width, height, ch;
|
||||||
GLFWmonitor monitor = NULL;
|
GLFWmonitor* monitor = NULL;
|
||||||
GLFWwindow window;
|
GLFWwindow* window;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "fh")) != -1)
|
while ((ch = getopt(argc, argv, "fh")) != -1)
|
||||||
{
|
{
|
||||||
|
@ -184,7 +184,7 @@ int main(int argc, char** argv)
|
|||||||
int ch, api = 0, profile = 0, strategy = 0, major = 1, minor = 0, revision;
|
int ch, api = 0, profile = 0, strategy = 0, major = 1, minor = 0, revision;
|
||||||
GLboolean debug = GL_FALSE, forward = GL_FALSE, list = GL_FALSE;
|
GLboolean debug = GL_FALSE, forward = GL_FALSE, list = GL_FALSE;
|
||||||
GLint flags, mask;
|
GLint flags, mask;
|
||||||
GLFWwindow window;
|
GLFWwindow* window;
|
||||||
|
|
||||||
if (!valid_version())
|
if (!valid_version())
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
@ -47,13 +47,13 @@ static void error_callback(int error, const char* description)
|
|||||||
fprintf(stderr, "Error: %s\n", description);
|
fprintf(stderr, "Error: %s\n", description);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int window_close_callback(GLFWwindow window)
|
static int window_close_callback(GLFWwindow* window)
|
||||||
{
|
{
|
||||||
closed = GL_TRUE;
|
closed = GL_TRUE;
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void key_callback(GLFWwindow window, int key, int action)
|
static void key_callback(GLFWwindow* window, int key, int action)
|
||||||
{
|
{
|
||||||
printf("%0.2f Key %s\n",
|
printf("%0.2f Key %s\n",
|
||||||
glfwGetTime(),
|
glfwGetTime(),
|
||||||
@ -73,21 +73,21 @@ static void key_callback(GLFWwindow window, int key, int action)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void window_size_callback(GLFWwindow window, int width, int height)
|
static void window_size_callback(GLFWwindow* window, int width, int height)
|
||||||
{
|
{
|
||||||
printf("%0.2f Window resized to %ix%i\n", glfwGetTime(), width, height);
|
printf("%0.2f Window resized to %ix%i\n", glfwGetTime(), width, height);
|
||||||
|
|
||||||
glViewport(0, 0, width, height);
|
glViewport(0, 0, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void window_focus_callback(GLFWwindow window, int focused)
|
static void window_focus_callback(GLFWwindow* window, int focused)
|
||||||
{
|
{
|
||||||
printf("%0.2f Window %s\n",
|
printf("%0.2f Window %s\n",
|
||||||
glfwGetTime(),
|
glfwGetTime(),
|
||||||
focused ? "focused" : "defocused");
|
focused ? "focused" : "defocused");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void window_iconify_callback(GLFWwindow window, int iconified)
|
static void window_iconify_callback(GLFWwindow* window, int iconified)
|
||||||
{
|
{
|
||||||
printf("%0.2f Window %s\n",
|
printf("%0.2f Window %s\n",
|
||||||
glfwGetTime(),
|
glfwGetTime(),
|
||||||
@ -97,8 +97,8 @@ static void window_iconify_callback(GLFWwindow window, int iconified)
|
|||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
int width, height, ch;
|
int width, height, ch;
|
||||||
GLFWmonitor monitor = NULL;
|
GLFWmonitor* monitor = NULL;
|
||||||
GLFWwindow window;
|
GLFWwindow* window;
|
||||||
|
|
||||||
glfwSetErrorCallback(error_callback);
|
glfwSetErrorCallback(error_callback);
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ static void error_callback(int error, const char* description)
|
|||||||
fprintf(stderr, "Error: %s\n", description);
|
fprintf(stderr, "Error: %s\n", description);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void window_size_callback(GLFWwindow window, int width, int height)
|
static void window_size_callback(GLFWwindow* window, int width, int height)
|
||||||
{
|
{
|
||||||
glViewport(0, 0, width, height);
|
glViewport(0, 0, width, height);
|
||||||
}
|
}
|
||||||
@ -100,7 +100,7 @@ static void draw_joystick(Joystick* j, int x, int y, int width, int height)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void draw_joysticks(GLFWwindow window)
|
static void draw_joysticks(GLFWwindow* window)
|
||||||
{
|
{
|
||||||
int i, width, height;
|
int i, width, height;
|
||||||
|
|
||||||
@ -186,7 +186,7 @@ static void refresh_joysticks(void)
|
|||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
GLFWwindow window;
|
GLFWwindow* window;
|
||||||
|
|
||||||
memset(joysticks, 0, sizeof(joysticks));
|
memset(joysticks, 0, sizeof(joysticks));
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
#include "getopt.h"
|
#include "getopt.h"
|
||||||
|
|
||||||
static GLFWwindow window_handle = NULL;
|
static GLFWwindow* window_handle = NULL;
|
||||||
|
|
||||||
enum Mode
|
enum Mode
|
||||||
{
|
{
|
||||||
@ -68,20 +68,20 @@ static void error_callback(int error, const char* description)
|
|||||||
fprintf(stderr, "Error: %s\n", description);
|
fprintf(stderr, "Error: %s\n", description);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void window_size_callback(GLFWwindow window, int width, int height)
|
static void window_size_callback(GLFWwindow* window, int width, int height)
|
||||||
{
|
{
|
||||||
printf("Window resized to %ix%i\n", width, height);
|
printf("Window resized to %ix%i\n", width, height);
|
||||||
|
|
||||||
glViewport(0, 0, width, height);
|
glViewport(0, 0, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int window_close_callback(GLFWwindow window)
|
static int window_close_callback(GLFWwindow* window)
|
||||||
{
|
{
|
||||||
window_handle = NULL;
|
window_handle = NULL;
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void key_callback(GLFWwindow window, int key, int action)
|
static void key_callback(GLFWwindow* window, int key, int action)
|
||||||
{
|
{
|
||||||
if (key == GLFW_KEY_ESCAPE)
|
if (key == GLFW_KEY_ESCAPE)
|
||||||
{
|
{
|
||||||
@ -90,7 +90,7 @@ static void key_callback(GLFWwindow window, int key, int action)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void list_modes(GLFWmonitor monitor)
|
static void list_modes(GLFWmonitor* monitor)
|
||||||
{
|
{
|
||||||
int count, widthMM, heightMM, dpi, i;
|
int count, widthMM, heightMM, dpi, i;
|
||||||
GLFWvidmode mode;
|
GLFWvidmode mode;
|
||||||
@ -124,7 +124,7 @@ static void list_modes(GLFWmonitor monitor)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_modes(GLFWmonitor monitor)
|
static void test_modes(GLFWmonitor* monitor)
|
||||||
{
|
{
|
||||||
int i, count;
|
int i, count;
|
||||||
const GLFWvidmode* modes = glfwGetVideoModes(monitor, &count);
|
const GLFWvidmode* modes = glfwGetVideoModes(monitor, &count);
|
||||||
@ -212,7 +212,7 @@ static void test_modes(GLFWmonitor monitor)
|
|||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
int ch, i, count, mode = LIST_MODE;
|
int ch, i, count, mode = LIST_MODE;
|
||||||
const GLFWmonitor* monitors;
|
GLFWmonitor** monitors;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "th")) != -1)
|
while ((ch = getopt(argc, argv, "th")) != -1)
|
||||||
{
|
{
|
||||||
|
@ -36,13 +36,13 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
static GLboolean reopen = GL_FALSE;
|
static GLboolean reopen = GL_FALSE;
|
||||||
static GLFWwindow window_handle = NULL;
|
static GLFWwindow* window_handle = NULL;
|
||||||
static int cursor_x;
|
static int cursor_x;
|
||||||
static int cursor_y;
|
static int cursor_y;
|
||||||
|
|
||||||
static GLboolean open_window(void);
|
static GLboolean open_window(void);
|
||||||
|
|
||||||
static void toggle_cursor(GLFWwindow window)
|
static void toggle_cursor(GLFWwindow* window)
|
||||||
{
|
{
|
||||||
if (glfwGetInputMode(window, GLFW_CURSOR_MODE) == GLFW_CURSOR_CAPTURED)
|
if (glfwGetInputMode(window, GLFW_CURSOR_MODE) == GLFW_CURSOR_CAPTURED)
|
||||||
{
|
{
|
||||||
@ -61,14 +61,14 @@ static void error_callback(int error, const char* description)
|
|||||||
fprintf(stderr, "Error: %s\n", description);
|
fprintf(stderr, "Error: %s\n", description);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cursor_position_callback(GLFWwindow window, int x, int y)
|
static void cursor_position_callback(GLFWwindow* window, int x, int y)
|
||||||
{
|
{
|
||||||
printf("Cursor moved to: %i %i (%i %i)\n", x, y, x - cursor_x, y - cursor_y);
|
printf("Cursor moved to: %i %i (%i %i)\n", x, y, x - cursor_x, y - cursor_y);
|
||||||
cursor_x = x;
|
cursor_x = x;
|
||||||
cursor_y = y;
|
cursor_y = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void key_callback(GLFWwindow window, int key, int action)
|
static void key_callback(GLFWwindow* window, int key, int action)
|
||||||
{
|
{
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
@ -90,7 +90,7 @@ static void key_callback(GLFWwindow window, int key, int action)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void window_size_callback(GLFWwindow window, int width, int height)
|
static void window_size_callback(GLFWwindow* window, int width, int height)
|
||||||
{
|
{
|
||||||
glViewport(0, 0, width, height);
|
glViewport(0, 0, width, height);
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
static GLFWwindow window_handle = NULL;
|
static GLFWwindow* window_handle = NULL;
|
||||||
static GLboolean closed = GL_FALSE;
|
static GLboolean closed = GL_FALSE;
|
||||||
|
|
||||||
static void error_callback(int error, const char* description)
|
static void error_callback(int error, const char* description)
|
||||||
@ -46,19 +46,19 @@ static void error_callback(int error, const char* description)
|
|||||||
fprintf(stderr, "Error: %s\n", description);
|
fprintf(stderr, "Error: %s\n", description);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void window_size_callback(GLFWwindow window, int width, int height)
|
static void window_size_callback(GLFWwindow* window, int width, int height)
|
||||||
{
|
{
|
||||||
glViewport(0, 0, width, height);
|
glViewport(0, 0, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int window_close_callback(GLFWwindow window)
|
static int window_close_callback(GLFWwindow* window)
|
||||||
{
|
{
|
||||||
printf("Close callback triggered\n");
|
printf("Close callback triggered\n");
|
||||||
closed = GL_TRUE;
|
closed = GL_TRUE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void key_callback(GLFWwindow window, int key, int action)
|
static void key_callback(GLFWwindow* window, int key, int action)
|
||||||
{
|
{
|
||||||
if (action != GLFW_PRESS)
|
if (action != GLFW_PRESS)
|
||||||
return;
|
return;
|
||||||
@ -72,7 +72,7 @@ static void key_callback(GLFWwindow window, int key, int action)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static GLboolean open_window(int width, int height, GLFWmonitor monitor)
|
static GLboolean open_window(int width, int height, GLFWmonitor* monitor)
|
||||||
{
|
{
|
||||||
double base;
|
double base;
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
GLFWmonitor monitor = NULL;
|
GLFWmonitor* monitor = NULL;
|
||||||
|
|
||||||
if (count & 1)
|
if (count & 1)
|
||||||
monitor = glfwGetPrimaryMonitor();
|
monitor = glfwGetPrimaryMonitor();
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
#define WIDTH 400
|
#define WIDTH 400
|
||||||
#define HEIGHT 400
|
#define HEIGHT 400
|
||||||
|
|
||||||
static GLFWwindow windows[2];
|
static GLFWwindow* windows[2];
|
||||||
static GLboolean closed = GL_FALSE;
|
static GLboolean closed = GL_FALSE;
|
||||||
|
|
||||||
static void error_callback(int error, const char* description)
|
static void error_callback(int error, const char* description)
|
||||||
@ -44,21 +44,21 @@ static void error_callback(int error, const char* description)
|
|||||||
fprintf(stderr, "Error: %s\n", description);
|
fprintf(stderr, "Error: %s\n", description);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void key_callback(GLFWwindow window, int key, int action)
|
static void key_callback(GLFWwindow* window, int key, int action)
|
||||||
{
|
{
|
||||||
if (action == GLFW_PRESS && key == GLFW_KEY_ESCAPE)
|
if (action == GLFW_PRESS && key == GLFW_KEY_ESCAPE)
|
||||||
closed = GL_TRUE;
|
closed = GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int window_close_callback(GLFWwindow window)
|
static int window_close_callback(GLFWwindow* window)
|
||||||
{
|
{
|
||||||
closed = GL_TRUE;
|
closed = GL_TRUE;
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GLFWwindow open_window(const char* title, GLFWwindow share, int posX, int posY)
|
static GLFWwindow* open_window(const char* title, GLFWwindow* share, int posX, int posY)
|
||||||
{
|
{
|
||||||
GLFWwindow window;
|
GLFWwindow* window;
|
||||||
|
|
||||||
glfwWindowHint(GLFW_POSITION_X, posX);
|
glfwWindowHint(GLFW_POSITION_X, posX);
|
||||||
glfwWindowHint(GLFW_POSITION_Y, posY);
|
glfwWindowHint(GLFW_POSITION_Y, posY);
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
static int swap_interval;
|
static int swap_interval;
|
||||||
|
|
||||||
static void set_swap_interval(GLFWwindow window, int interval)
|
static void set_swap_interval(GLFWwindow* window, int interval)
|
||||||
{
|
{
|
||||||
char title[256];
|
char title[256];
|
||||||
|
|
||||||
@ -53,12 +53,12 @@ static void error_callback(int error, const char* description)
|
|||||||
fprintf(stderr, "Error: %s\n", description);
|
fprintf(stderr, "Error: %s\n", description);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void window_size_callback(GLFWwindow window, int width, int height)
|
static void window_size_callback(GLFWwindow* window, int width, int height)
|
||||||
{
|
{
|
||||||
glViewport(0, 0, width, height);
|
glViewport(0, 0, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void key_callback(GLFWwindow window, int key, int action)
|
static void key_callback(GLFWwindow* window, int key, int action)
|
||||||
{
|
{
|
||||||
if (key == GLFW_KEY_SPACE && action == GLFW_PRESS)
|
if (key == GLFW_KEY_SPACE && action == GLFW_PRESS)
|
||||||
set_swap_interval(window, 1 - swap_interval);
|
set_swap_interval(window, 1 - swap_interval);
|
||||||
@ -67,7 +67,7 @@ static void key_callback(GLFWwindow window, int key, int action)
|
|||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
float position;
|
float position;
|
||||||
GLFWwindow window;
|
GLFWwindow* window;
|
||||||
|
|
||||||
glfwSetErrorCallback(error_callback);
|
glfwSetErrorCallback(error_callback);
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
GLFWwindow window;
|
GLFWwindow* window;
|
||||||
const char* title;
|
const char* title;
|
||||||
float r, g, b;
|
float r, g, b;
|
||||||
thrd_t id;
|
thrd_t id;
|
||||||
|
@ -37,14 +37,14 @@ static void error_callback(int error, const char* description)
|
|||||||
fprintf(stderr, "Error: %s\n", description);
|
fprintf(stderr, "Error: %s\n", description);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void window_size_callback(GLFWwindow window, int width, int height)
|
static void window_size_callback(GLFWwindow* window, int width, int height)
|
||||||
{
|
{
|
||||||
glViewport(0, 0, width, height);
|
glViewport(0, 0, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
GLFWwindow window;
|
GLFWwindow* window;
|
||||||
|
|
||||||
glfwSetErrorCallback(error_callback);
|
glfwSetErrorCallback(error_callback);
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ int main(void)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
GLboolean running = GL_TRUE;
|
GLboolean running = GL_TRUE;
|
||||||
GLFWwindow windows[4];
|
GLFWwindow* windows[4];
|
||||||
|
|
||||||
glfwSetErrorCallback(error_callback);
|
glfwSetErrorCallback(error_callback);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user