Merge remote-tracking branch 'svn/trunk' into git_master
This commit is contained in:
commit
79c2f10235
@ -82,7 +82,7 @@ FGAPI void FGAPIENTRY glutInitWarningFuncUcall( void (* callback)( const char *f
|
|||||||
FGAPI void FGAPIENTRY glutInitContextFuncUcall( void (* callback)( void* ), void* user_data );
|
FGAPI void FGAPIENTRY glutInitContextFuncUcall( void (* callback)( void* ), void* user_data );
|
||||||
FGAPI void FGAPIENTRY glutAppStatusFuncUcall( void (* callback)( int, void* ), void* user_data );
|
FGAPI void FGAPIENTRY glutAppStatusFuncUcall( void (* callback)( int, void* ), void* user_data );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Continued "hack" from GLUT applied to Ucall functions.
|
* Continued "hack" from GLUT applied to Ucall functions.
|
||||||
* For more info, see bottom of freeglut_std.h
|
* For more info, see bottom of freeglut_std.h
|
||||||
*/
|
*/
|
||||||
|
@ -5,10 +5,10 @@
|
|||||||
in OpenGLUT. It may also be useful to see which
|
in OpenGLUT. It may also be useful to see which
|
||||||
parameters control what behavior in the OpenGLUT
|
parameters control what behavior in the OpenGLUT
|
||||||
objects.
|
objects.
|
||||||
|
|
||||||
Spinning wireframe and solid-shaded shapes are
|
Spinning wireframe and solid-shaded shapes are
|
||||||
displayed. Some parameters can be adjusted.
|
displayed. Some parameters can be adjusted.
|
||||||
|
|
||||||
Keys:
|
Keys:
|
||||||
- <tt>Esc </tt> Quit
|
- <tt>Esc </tt> Quit
|
||||||
- <tt>q Q </tt> Quit
|
- <tt>q Q </tt> Quit
|
||||||
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
\author Portions Copyright (C) 2004, the OpenGLUT project contributors. <br>
|
\author Portions Copyright (C) 2004, the OpenGLUT project contributors. <br>
|
||||||
OpenGLUT branched from freeglut in February, 2004.
|
OpenGLUT branched from freeglut in February, 2004.
|
||||||
|
|
||||||
\image html openglut_shapes.png OpenGLUT Geometric Shapes Demonstration
|
\image html openglut_shapes.png OpenGLUT Geometric Shapes Demonstration
|
||||||
\include demos/shapes/shapes.c
|
\include demos/shapes/shapes.c
|
||||||
*/
|
*/
|
||||||
@ -63,7 +63,7 @@ void checkError(const char *functionName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* OpenGL 2+ shader mode needs some function and macro definitions,
|
* OpenGL 2+ shader mode needs some function and macro definitions,
|
||||||
* avoiding a dependency on additional libraries like GLEW or the
|
* avoiding a dependency on additional libraries like GLEW or the
|
||||||
* GL/glext.h header
|
* GL/glext.h header
|
||||||
*/
|
*/
|
||||||
@ -283,10 +283,10 @@ GLint getAttribOrUniformLocation(const char* name, GLuint program, GLboolean isA
|
|||||||
GLint attrib = gl_GetAttribLocation(program, name);
|
GLint attrib = gl_GetAttribLocation(program, name);
|
||||||
if (attrib == -1)
|
if (attrib == -1)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Warning: Could not bind attrib %s\n", name);
|
fprintf(stderr, "Warning: Could not bind attrib %s\n", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
checkError ("getAttribOrUniformLocation");
|
checkError ("getAttribOrUniformLocation");
|
||||||
return attrib;
|
return attrib;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -294,16 +294,16 @@ GLint getAttribOrUniformLocation(const char* name, GLuint program, GLboolean isA
|
|||||||
GLint uniform = gl_GetUniformLocation(program, name);
|
GLint uniform = gl_GetUniformLocation(program, name);
|
||||||
if (uniform == -1)
|
if (uniform == -1)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Warning: Could not bind uniform %s\n", name);
|
fprintf(stderr, "Warning: Could not bind uniform %s\n", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
checkError ("getAttribOrUniformLocation");
|
checkError ("getAttribOrUniformLocation");
|
||||||
return uniform;
|
return uniform;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint program;
|
GLuint program;
|
||||||
GLint attribute_fg_coord = -1, attribute_fg_normal = -1;
|
GLint attribute_fg_coord = -1, attribute_fg_normal = -1;
|
||||||
GLint uniform_m = -1, uniform_p = -1, uniform_m_3x3_inv_transp = -1;
|
GLint uniform_m = -1, uniform_p = -1, uniform_m_3x3_inv_transp = -1;
|
||||||
GLint shaderReady = 0; /* Set to 1 when all initialization went well, to -1 when shader somehow unusable. */
|
GLint shaderReady = 0; /* Set to 1 when all initialization went well, to -1 when shader somehow unusable. */
|
||||||
|
|
||||||
@ -800,10 +800,10 @@ key(unsigned char key, int x, int y)
|
|||||||
case '.':
|
case '.':
|
||||||
case '>': stacks++; break;
|
case '>': stacks++; break;
|
||||||
|
|
||||||
case '9':
|
case '9':
|
||||||
case '(': if( depth > -1 ) depth--; break;
|
case '(': if( depth > -1 ) depth--; break;
|
||||||
|
|
||||||
case '0':
|
case '0':
|
||||||
case ')': ++depth; break;
|
case ')': ++depth; break;
|
||||||
|
|
||||||
case 'P':
|
case 'P':
|
||||||
|
@ -39,11 +39,11 @@
|
|||||||
|
|
||||||
/* What supports variadic macros based off Wikipedia article on it (GCC-like must support C99 or higher to use variadic macros) */
|
/* What supports variadic macros based off Wikipedia article on it (GCC-like must support C99 or higher to use variadic macros) */
|
||||||
#if (((defined(__GNUC__) && (__GNUC__ >= 3)) || \
|
#if (((defined(__GNUC__) && (__GNUC__ >= 3)) || \
|
||||||
(defined(__clang__))) && \
|
(defined(__clang__))) && \
|
||||||
(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))) || \
|
(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))) || \
|
||||||
(defined(_MSC_VER) && (_MSC_VER >= 1400)) || \
|
(defined(_MSC_VER) && (_MSC_VER >= 1400)) || \
|
||||||
(defined(__BORLANDC__) && (__BORLANDC__ >= 0x570)) || \
|
(defined(__BORLANDC__) && (__BORLANDC__ >= 0x570)) || \
|
||||||
(defined(__SUNPRO_C) && (__SUNPRO_C >= 0x530))
|
(defined(__SUNPRO_C) && (__SUNPRO_C >= 0x530))
|
||||||
#define FG_COMPILER_SUPPORTS_VA_ARGS 1
|
#define FG_COMPILER_SUPPORTS_VA_ARGS 1
|
||||||
#else
|
#else
|
||||||
#define FG_COMPILER_SUPPORTS_VA_ARGS 0
|
#define FG_COMPILER_SUPPORTS_VA_ARGS 0
|
||||||
@ -58,7 +58,7 @@
|
|||||||
*
|
*
|
||||||
* This took a while to figure out, so be sure try to understand what is happening so that you can ensure that whatever you
|
* This took a while to figure out, so be sure try to understand what is happening so that you can ensure that whatever you
|
||||||
* change won't break other areas.
|
* change won't break other areas.
|
||||||
*
|
*
|
||||||
* If you are just adding a new callback/changing it's argument count, just go to the bottom of the file.
|
* If you are just adding a new callback/changing it's argument count, just go to the bottom of the file.
|
||||||
*
|
*
|
||||||
* This whole file exists purely for the sake of preventing the need to implement additional parsing logic for each callback
|
* This whole file exists purely for the sake of preventing the need to implement additional parsing logic for each callback
|
||||||
@ -70,26 +70,26 @@
|
|||||||
* then the GCC macro, so maybe it's good to stay as is.
|
* then the GCC macro, so maybe it's good to stay as is.
|
||||||
*
|
*
|
||||||
* Onto the different "versions" of macros:
|
* Onto the different "versions" of macros:
|
||||||
*
|
*
|
||||||
* The first is for any compiler that supports C99 by default. It requires each callback to have a specific argument count
|
* The first is for any compiler that supports C99 by default. It requires each callback to have a specific argument count
|
||||||
* passthrough macro. The only reason there are specific count macros is so that (see paraghraph below) don't need have their own
|
* passthrough macro. The only reason there are specific count macros is so that (see paraghraph below) don't need have their own
|
||||||
* set of callback macros. Ideally, there would only be ZERO and ONE_OR_MORE. This works by having callback-specific macros call a
|
* set of callback macros. Ideally, there would only be ZERO and ONE_OR_MORE. This works by having callback-specific macros call a
|
||||||
* specific handler macro to return user data (ZERO) or return one or more arguments along with userData (ONE_OR_MORE) where, with
|
* specific handler macro to return user data (ZERO) or return one or more arguments along with userData (ONE_OR_MORE) where, with
|
||||||
* variadic macros, it just reuses the arguments.
|
* variadic macros, it just reuses the arguments.
|
||||||
*
|
*
|
||||||
* The last macro set is for the poor individual who has to use a compiler that doesn't support C99 by default, or may not support
|
* The last macro set is for the poor individual who has to use a compiler that doesn't support C99 by default, or may not support
|
||||||
* it at all. Stuff like MSVC6... It works by having a specific-count macro that "extracts" each argument to have them reused without
|
* it at all. Stuff like MSVC6... It works by having a specific-count macro that "extracts" each argument to have them reused without
|
||||||
* the parathesis.
|
* the parathesis.
|
||||||
*
|
*
|
||||||
* There is a 3rd macro set that only worked on GCC/Clang, and thus was removed (last seen in revision e9676fc of the GIT mirror.
|
* There is a 3rd macro set that only worked on GCC/Clang, and thus was removed (last seen in revision e9676fc of the GIT mirror.
|
||||||
* Not sure at this time what the SVN number is.) as it's a non-standard functionality.
|
* Not sure at this time what the SVN number is.) as it's a non-standard functionality.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* EXPAND_WCB() is used as:
|
* EXPAND_WCB() is used as:
|
||||||
*
|
*
|
||||||
* EXPAND_WCB( cbname )(( arg_list, userData ))
|
* EXPAND_WCB( cbname )(( arg_list, userData ))
|
||||||
*
|
*
|
||||||
* ... where {(arg_list)} is the parameter list and userData is user
|
* ... where {(arg_list)} is the parameter list and userData is user
|
||||||
* provided data.
|
* provided data.
|
||||||
*
|
*
|
||||||
@ -140,7 +140,7 @@
|
|||||||
|
|
||||||
#define EXPAND_WCB(cbname) EXPAND_WCB_SUB_ ## cbname
|
#define EXPAND_WCB(cbname) EXPAND_WCB_SUB_ ## cbname
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Freeglut callbacks type definitions macros
|
* Freeglut callbacks type definitions macros
|
||||||
*
|
*
|
||||||
* Every time a callback is updated in fg_internal.h is updated, this needs updated
|
* Every time a callback is updated in fg_internal.h is updated, this needs updated
|
||||||
@ -261,8 +261,8 @@ void FGAPIENTRY glut##a##Func( FGCB##b callback ) \
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_2NAME_GLUT(a,b) \
|
#define IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_2NAME_GLUT(a,b) \
|
||||||
IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_2NAME_GLUT_UCALL(a,b) \
|
IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_2NAME_GLUT_UCALL(a,b) \
|
||||||
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,b)
|
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,b)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Combine _glut and _cb macros:
|
* Combine _glut and _cb macros:
|
||||||
@ -276,20 +276,20 @@ void FGAPIENTRY glut##a##Func( FGCB##b callback ) \
|
|||||||
IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_2NAME_GLUT(a,b)
|
IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_2NAME_GLUT(a,b)
|
||||||
|
|
||||||
#define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG0(a) \
|
#define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG0(a) \
|
||||||
IMPLEMENT_CALLBACK_FUNC_CB_ARG0(a,a) \
|
IMPLEMENT_CALLBACK_FUNC_CB_ARG0(a,a) \
|
||||||
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,a)
|
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,a)
|
||||||
|
|
||||||
#define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG0_2NAME(a,b) \
|
#define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG0_2NAME(a,b) \
|
||||||
IMPLEMENT_CALLBACK_FUNC_CB_ARG0(a,b) \
|
IMPLEMENT_CALLBACK_FUNC_CB_ARG0(a,b) \
|
||||||
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,b)
|
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,b)
|
||||||
|
|
||||||
#define IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_ARG1(a) \
|
#define IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_ARG1(a) \
|
||||||
IMPLEMENT_CALLBACK_FUNC_CB_ARG1(a,a) \
|
IMPLEMENT_CALLBACK_FUNC_CB_ARG1(a,a) \
|
||||||
IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_2NAME_GLUT(a,a)
|
IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_2NAME_GLUT(a,a)
|
||||||
|
|
||||||
#define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG1(a) \
|
#define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG1(a) \
|
||||||
IMPLEMENT_CALLBACK_FUNC_CB_ARG1(a,a) \
|
IMPLEMENT_CALLBACK_FUNC_CB_ARG1(a,a) \
|
||||||
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,a)
|
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,a)
|
||||||
|
|
||||||
#define IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_ARG2(a) \
|
#define IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_ARG2(a) \
|
||||||
IMPLEMENT_CALLBACK_FUNC_CB_ARG2(a,a) \
|
IMPLEMENT_CALLBACK_FUNC_CB_ARG2(a,a) \
|
||||||
@ -300,12 +300,12 @@ void FGAPIENTRY glut##a##Func( FGCB##b callback ) \
|
|||||||
IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_2NAME_GLUT(a,b)
|
IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_2NAME_GLUT(a,b)
|
||||||
|
|
||||||
#define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG2(a) \
|
#define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG2(a) \
|
||||||
IMPLEMENT_CALLBACK_FUNC_CB_ARG2(a,a) \
|
IMPLEMENT_CALLBACK_FUNC_CB_ARG2(a,a) \
|
||||||
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,a)
|
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,a)
|
||||||
|
|
||||||
#define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG2_2NAME(a,b) \
|
#define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG2_2NAME(a,b) \
|
||||||
IMPLEMENT_CALLBACK_FUNC_CB_ARG2(a,b) \
|
IMPLEMENT_CALLBACK_FUNC_CB_ARG2(a,b) \
|
||||||
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,b)
|
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,b)
|
||||||
|
|
||||||
#define IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_ARG3(a) \
|
#define IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_ARG3(a) \
|
||||||
IMPLEMENT_CALLBACK_FUNC_CB_ARG3(a,a) \
|
IMPLEMENT_CALLBACK_FUNC_CB_ARG3(a,a) \
|
||||||
@ -316,12 +316,12 @@ void FGAPIENTRY glut##a##Func( FGCB##b callback ) \
|
|||||||
IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_2NAME_GLUT(a,a)
|
IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_2NAME_GLUT(a,a)
|
||||||
|
|
||||||
#define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG3(a) \
|
#define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG3(a) \
|
||||||
IMPLEMENT_CALLBACK_FUNC_CB_ARG3(a,a) \
|
IMPLEMENT_CALLBACK_FUNC_CB_ARG3(a,a) \
|
||||||
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,a)
|
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,a)
|
||||||
|
|
||||||
#define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG3_2NAME(a,b) \
|
#define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG3_2NAME(a,b) \
|
||||||
IMPLEMENT_CALLBACK_FUNC_CB_ARG3(a,b) \
|
IMPLEMENT_CALLBACK_FUNC_CB_ARG3(a,b) \
|
||||||
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,b)
|
IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,b)
|
||||||
|
|
||||||
#define IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_ARG4(a) \
|
#define IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_ARG4(a) \
|
||||||
IMPLEMENT_CALLBACK_FUNC_CB_ARG4(a,a) \
|
IMPLEMENT_CALLBACK_FUNC_CB_ARG4(a,a) \
|
||||||
|
@ -42,10 +42,10 @@ void FGAPIENTRY glutPostRedisplay( void )
|
|||||||
{
|
{
|
||||||
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutPostRedisplay" );
|
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutPostRedisplay" );
|
||||||
if ( ! fgStructure.CurrentWindow )
|
if ( ! fgStructure.CurrentWindow )
|
||||||
{
|
{
|
||||||
fgError ( " ERROR: Function <%s> called"
|
fgError ( " ERROR: Function <%s> called"
|
||||||
" with no current window defined.", "glutPostRedisplay" ) ;
|
" with no current window defined.", "glutPostRedisplay" ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
fgStructure.CurrentWindow->State.WorkMask |= GLUT_DISPLAY_WORK;
|
fgStructure.CurrentWindow->State.WorkMask |= GLUT_DISPLAY_WORK;
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file has been automatically generated by the
|
* This file has been automatically generated by the
|
||||||
* genfonts utility.
|
* genfonts utility.
|
||||||
*
|
*
|
||||||
* The legal status of this file is a bit vague. The font glyphs
|
* The legal status of this file is a bit vague. The font glyphs
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1999-2000 by Pawel W. Olszta
|
* Copyright (c) 1999-2000 by Pawel W. Olszta
|
||||||
* Written by Pawel W. Olszta, <olszta@sourceforge.net>
|
* Written by Pawel W. Olszta, <olszta@sourceforge.net>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
* to deal in the Software without restriction, including without limitation
|
* to deal in the Software without restriction, including without limitation
|
||||||
@ -55,7 +55,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* The following bitmapped fonts are defined in this file:
|
* The following bitmapped fonts are defined in this file:
|
||||||
*
|
*
|
||||||
* 1. fgFontFixed8x13
|
* 1. fgFontFixed8x13
|
||||||
* -misc-fixed-medium-r-normal--13-120-75-75-C-80-iso8859-1
|
* -misc-fixed-medium-r-normal--13-120-75-75-C-80-iso8859-1
|
||||||
* 2. fgFontFixed9x15
|
* 2. fgFontFixed9x15
|
||||||
|
@ -111,7 +111,7 @@ void fgInitialiseInputDevices ( void )
|
|||||||
{
|
{
|
||||||
const char *dial_device=NULL;
|
const char *dial_device=NULL;
|
||||||
dial_device = getenv ( "GLUT_DIALS_SERIAL" );
|
dial_device = getenv ( "GLUT_DIALS_SERIAL" );
|
||||||
fgPlatformRegisterDialDevice ( dial_device );
|
fgPlatformRegisterDialDevice ( dial_device );
|
||||||
|
|
||||||
if ( !dial_device ) return;
|
if ( !dial_device ) return;
|
||||||
if ( !( dialbox_port = serial_open ( dial_device ) ) ) return;
|
if ( !( dialbox_port = serial_open ( dial_device ) ) ) return;
|
||||||
|
@ -214,7 +214,7 @@
|
|||||||
|
|
||||||
/* -- GLOBAL TYPE DEFINITIONS ---------------------------------------------- */
|
/* -- GLOBAL TYPE DEFINITIONS ---------------------------------------------- */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Freeglut callbacks type definitions
|
* Freeglut callbacks type definitions
|
||||||
*
|
*
|
||||||
* If anything here is modified or added, update fg_callback_macros.h functions.
|
* If anything here is modified or added, update fg_callback_macros.h functions.
|
||||||
@ -392,7 +392,7 @@ struct tagSFG_State
|
|||||||
int NumActiveJoysticks; /* Number of active joysticks (callback defined and positive pollrate) -- if zero, don't poll joysticks */
|
int NumActiveJoysticks; /* Number of active joysticks (callback defined and positive pollrate) -- if zero, don't poll joysticks */
|
||||||
GLboolean InputDevsInitialised; /* Only initialize if application calls for them */
|
GLboolean InputDevsInitialised; /* Only initialize if application calls for them */
|
||||||
|
|
||||||
int MouseWheelTicks; /* Number of ticks the mouse wheel has turned */
|
int MouseWheelTicks; /* Number of ticks the mouse wheel has turned */
|
||||||
|
|
||||||
int AuxiliaryBufferNumber;/* Number of auxiliary buffers */
|
int AuxiliaryBufferNumber;/* Number of auxiliary buffers */
|
||||||
int SampleNumber; /* Number of samples per pixel */
|
int SampleNumber; /* Number of samples per pixel */
|
||||||
@ -417,7 +417,7 @@ struct tagSFG_State
|
|||||||
typedef struct tagSFG_Display SFG_Display;
|
typedef struct tagSFG_Display SFG_Display;
|
||||||
struct tagSFG_Display
|
struct tagSFG_Display
|
||||||
{
|
{
|
||||||
SFG_PlatformDisplay pDisplay;
|
SFG_PlatformDisplay pDisplay;
|
||||||
|
|
||||||
int ScreenWidth; /* The screen's width in pixels */
|
int ScreenWidth; /* The screen's width in pixels */
|
||||||
int ScreenHeight; /* The screen's height in pixels */
|
int ScreenHeight; /* The screen's height in pixels */
|
||||||
@ -447,7 +447,7 @@ struct tagSFG_Context
|
|||||||
SFG_WindowHandleType Handle; /* The window's handle */
|
SFG_WindowHandleType Handle; /* The window's handle */
|
||||||
SFG_WindowContextType Context; /* The window's OpenGL/WGL context */
|
SFG_WindowContextType Context; /* The window's OpenGL/WGL context */
|
||||||
|
|
||||||
SFG_PlatformContext pContext; /* The window's FBConfig (X11) or device context (Windows) */
|
SFG_PlatformContext pContext; /* The window's FBConfig (X11) or device context (Windows) */
|
||||||
|
|
||||||
int DoubleBuffered; /* Treat the window as double-buffered */
|
int DoubleBuffered; /* Treat the window as double-buffered */
|
||||||
|
|
||||||
@ -536,7 +536,7 @@ struct tagSFG_WindowState /* as per notes above, sizes always refer to the cli
|
|||||||
int DesiredZOrder; /* desired window Z Order position */
|
int DesiredZOrder; /* desired window Z Order position */
|
||||||
fgDesiredVisibility DesiredVisibility;/* desired visibility (hidden, iconic, shown/normal) */
|
fgDesiredVisibility DesiredVisibility;/* desired visibility (hidden, iconic, shown/normal) */
|
||||||
|
|
||||||
SFG_PlatformWindowState pWState; /* Window width/height (X11) or rectangle/style (Windows) from before a resize, and other stuff only needed on specific platforms */
|
SFG_PlatformWindowState pWState; /* Window width/height (X11) or rectangle/style (Windows) from before a resize, and other stuff only needed on specific platforms */
|
||||||
|
|
||||||
long JoystickPollRate; /* The joystick polling rate */
|
long JoystickPollRate; /* The joystick polling rate */
|
||||||
fg_time_t JoystickLastPoll; /* When the last poll happened */
|
fg_time_t JoystickLastPoll; /* When the last poll happened */
|
||||||
@ -589,10 +589,10 @@ do \
|
|||||||
(((window).CallBacks[WCB_ ## cbname]) = (SFG_Proc)(func)); \
|
(((window).CallBacks[WCB_ ## cbname]) = (SFG_Proc)(func)); \
|
||||||
(((window).CallbackDatas[WCB_ ## cbname]) = (udata)); \
|
(((window).CallbackDatas[WCB_ ## cbname]) = (udata)); \
|
||||||
} \
|
} \
|
||||||
else if( FETCH_USER_DATA_WCB( window, cbname ) != udata ) \
|
else if( FETCH_USER_DATA_WCB( window, cbname ) != udata ) \
|
||||||
{ \
|
{ \
|
||||||
(((window).CallbackDatas[WCB_ ## cbname]) = (udata)); \
|
(((window).CallbackDatas[WCB_ ## cbname]) = (udata)); \
|
||||||
} \
|
} \
|
||||||
} while( 0 )
|
} while( 0 )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -611,7 +611,7 @@ do \
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* FETCH_USER_DATA_WCB() is used as:
|
* FETCH_USER_DATA_WCB() is used as:
|
||||||
*
|
*
|
||||||
* FETCH_USER_DATA_WCB( window, cbname );
|
* FETCH_USER_DATA_WCB( window, cbname );
|
||||||
*
|
*
|
||||||
* ...where {window} is the freeglut window,
|
* ...where {window} is the freeglut window,
|
||||||
@ -626,9 +626,9 @@ do \
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* EXPAND_WCB() is used as:
|
* EXPAND_WCB() is used as:
|
||||||
*
|
*
|
||||||
* EXPAND_WCB( cbname )(( arg_list, userData ))
|
* EXPAND_WCB( cbname )(( arg_list, userData ))
|
||||||
*
|
*
|
||||||
* ... where {(arg_list)} is the parameter list and userData is user
|
* ... where {(arg_list)} is the parameter list and userData is user
|
||||||
* provided data.
|
* provided data.
|
||||||
*
|
*
|
||||||
@ -655,7 +655,7 @@ do \
|
|||||||
*
|
*
|
||||||
* callback( arg_list, userData );
|
* callback( arg_list, userData );
|
||||||
*
|
*
|
||||||
* ...where userData is added to the arg_list, but the parentheses
|
* ...where userData is added to the arg_list, but the parentheses
|
||||||
* are REQUIRED in the {arg_list}.
|
* are REQUIRED in the {arg_list}.
|
||||||
*
|
*
|
||||||
* NOTE that it does a sanity-check and also sets the
|
* NOTE that it does a sanity-check and also sets the
|
||||||
@ -670,7 +670,7 @@ do \
|
|||||||
FGCB ## cbname ## UC func = (FGCB ## cbname ## UC)(FETCH_WCB( window, cbname )); \
|
FGCB ## cbname ## UC func = (FGCB ## cbname ## UC)(FETCH_WCB( window, cbname )); \
|
||||||
FGCBUserData userData = FETCH_USER_DATA_WCB( window, cbname ); \
|
FGCBUserData userData = FETCH_USER_DATA_WCB( window, cbname ); \
|
||||||
fgSetWindow( &window ); \
|
fgSetWindow( &window ); \
|
||||||
func EXPAND_WCB( cbname )(( arg_list, userData )); \
|
func EXPAND_WCB( cbname )(( arg_list, userData )); \
|
||||||
} \
|
} \
|
||||||
} while( 0 )
|
} while( 0 )
|
||||||
|
|
||||||
@ -945,7 +945,7 @@ struct tagSFG_PlatformJoystick
|
|||||||
typedef struct tagSFG_Joystick SFG_Joystick;
|
typedef struct tagSFG_Joystick SFG_Joystick;
|
||||||
struct tagSFG_Joystick
|
struct tagSFG_Joystick
|
||||||
{
|
{
|
||||||
SFG_PlatformJoystick pJoystick;
|
SFG_PlatformJoystick pJoystick;
|
||||||
|
|
||||||
int id;
|
int id;
|
||||||
GLboolean error;
|
GLboolean error;
|
||||||
|
@ -135,7 +135,7 @@ static void fghDeactivateSubMenu( SFG_MenuEntry *menuEntry )
|
|||||||
static GLvoid fghGetVMaxExtent( SFG_Window* window, int* x, int* y )
|
static GLvoid fghGetVMaxExtent( SFG_Window* window, int* x, int* y )
|
||||||
{
|
{
|
||||||
if( fgStructure.GameModeWindow )
|
if( fgStructure.GameModeWindow )
|
||||||
fgPlatformGetGameModeVMaxExtent ( window, x, y );
|
fgPlatformGetGameModeVMaxExtent ( window, x, y );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*x = fgDisplay.ScreenWidth;
|
*x = fgDisplay.ScreenWidth;
|
||||||
@ -784,10 +784,10 @@ int FGAPIENTRY glutCreateMenuUcall( FGCBMenuUC callback, FGCBUserData userData )
|
|||||||
{
|
{
|
||||||
/* The menu object creation code resides in fg_structure.c */
|
/* The menu object creation code resides in fg_structure.c */
|
||||||
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutCreateMenuUcall" );
|
FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutCreateMenuUcall" );
|
||||||
if (fgState.ActiveMenus)
|
if (fgState.ActiveMenus)
|
||||||
{
|
{
|
||||||
fgError( "Menu manipulation not allowed while menus in use." );
|
fgError( "Menu manipulation not allowed while menus in use." );
|
||||||
}
|
}
|
||||||
|
|
||||||
return fgCreateMenu( callback, userData )->ID;
|
return fgCreateMenu( callback, userData )->ID;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ void fgInitialiseSpaceball(void)
|
|||||||
|
|
||||||
void fgSpaceballClose(void)
|
void fgSpaceballClose(void)
|
||||||
{
|
{
|
||||||
fgPlatformSpaceballClose();
|
fgPlatformSpaceballClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
int fgHasSpaceball(void)
|
int fgHasSpaceball(void)
|
||||||
@ -88,12 +88,12 @@ void fgSpaceballClose(void)
|
|||||||
|
|
||||||
int fgHasSpaceball(void)
|
int fgHasSpaceball(void)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fgSpaceballNumButtons(void)
|
int fgSpaceballNumButtons(void)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fgSpaceballSetWindow(SFG_Window *window)
|
void fgSpaceballSetWindow(SFG_Window *window)
|
||||||
|
@ -270,7 +270,7 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat )
|
|||||||
case GLUT_NUM_DIALS:
|
case GLUT_NUM_DIALS:
|
||||||
if ( fgState.InputDevsInitialised ) return 8;
|
if ( fgState.InputDevsInitialised ) return 8;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case GLUT_NUM_BUTTON_BOX_BUTTONS:
|
case GLUT_NUM_BUTTON_BOX_BUTTONS:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -293,7 +293,7 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat )
|
|||||||
return fgState.KeyRepeat;
|
return fgState.KeyRepeat;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return fgPlatformGlutDeviceGet ( eWhat );
|
return fgPlatformGlutDeviceGet ( eWhat );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title,
|
|||||||
fgError( "Out of memory. Could not create window." );
|
fgError( "Out of memory. Could not create window." );
|
||||||
}
|
}
|
||||||
|
|
||||||
fgPlatformCreateWindow ( window );
|
fgPlatformCreateWindow ( window );
|
||||||
|
|
||||||
fghClearCallBacks( window );
|
fghClearCallBacks( window );
|
||||||
SET_WCB( *window, Reshape, fghDefaultReshape, NULL);
|
SET_WCB( *window, Reshape, fghDefaultReshape, NULL);
|
||||||
@ -183,10 +183,10 @@ void fgAddToWindowDestroyList( SFG_Window* window )
|
|||||||
SET_WCB( *window, Destroy, destroy, destroyData );
|
SET_WCB( *window, Destroy, destroy, destroyData );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Similarly, clear all work set for the window, none of this has to be executed anymore
|
* Similarly, clear all work set for the window, none of this has to be executed anymore
|
||||||
*/
|
*/
|
||||||
window->State.WorkMask = 0;
|
window->State.WorkMask = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -102,17 +102,17 @@ void fgPlatformInitialize( const char* displayName )
|
|||||||
HDC context = CreateDC(fgDisplay.pDisplay.DisplayName,0,0,0);
|
HDC context = CreateDC(fgDisplay.pDisplay.DisplayName,0,0,0);
|
||||||
if( context )
|
if( context )
|
||||||
{
|
{
|
||||||
fgDisplay.ScreenWidth = GetDeviceCaps( context, HORZRES );
|
fgDisplay.ScreenWidth = GetDeviceCaps( context, HORZRES );
|
||||||
fgDisplay.ScreenHeight = GetDeviceCaps( context, VERTRES );
|
fgDisplay.ScreenHeight = GetDeviceCaps( context, VERTRES );
|
||||||
fgDisplay.ScreenWidthMM = GetDeviceCaps( context, HORZSIZE );
|
fgDisplay.ScreenWidthMM = GetDeviceCaps( context, HORZSIZE );
|
||||||
fgDisplay.ScreenHeightMM = GetDeviceCaps( context, VERTSIZE );
|
fgDisplay.ScreenHeightMM = GetDeviceCaps( context, VERTSIZE );
|
||||||
DeleteDC(context);
|
DeleteDC(context);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fgWarning("fgPlatformInitialize: "
|
fgWarning("fgPlatformInitialize: "
|
||||||
"CreateDC failed, Screen size info may be incorrect\n"
|
"CreateDC failed, Screen size info may be incorrect\n"
|
||||||
"This is quite likely caused by a bad '-display' parameter");
|
"This is quite likely caused by a bad '-display' parameter");
|
||||||
|
|
||||||
}
|
}
|
||||||
/* Set the timer granularity to 1 ms */
|
/* Set the timer granularity to 1 ms */
|
||||||
timeBeginPeriod ( 1 );
|
timeBeginPeriod ( 1 );
|
||||||
@ -142,7 +142,7 @@ void fgPlatformInitialize( const char* displayName )
|
|||||||
void fgPlatformDeinitialiseInputDevices ( void )
|
void fgPlatformDeinitialiseInputDevices ( void )
|
||||||
{
|
{
|
||||||
#if !defined(_WIN32_WCE)
|
#if !defined(_WIN32_WCE)
|
||||||
fghCloseInputDevices ();
|
fghCloseInputDevices ();
|
||||||
#endif /* !defined(_WIN32_WCE) */
|
#endif /* !defined(_WIN32_WCE) */
|
||||||
fgState.JoysticksInitialised = GL_FALSE;
|
fgState.JoysticksInitialised = GL_FALSE;
|
||||||
fgState.InputDevsInitialised = GL_FALSE;
|
fgState.InputDevsInitialised = GL_FALSE;
|
||||||
@ -162,7 +162,7 @@ void fgPlatformCloseDisplay ( void )
|
|||||||
|
|
||||||
void fgPlatformDestroyContext ( SFG_PlatformDisplay pDisplay, SFG_WindowContextType MContext )
|
void fgPlatformDestroyContext ( SFG_PlatformDisplay pDisplay, SFG_WindowContextType MContext )
|
||||||
{
|
{
|
||||||
/* Do nothing -- this is required for X11 */
|
/* Do nothing -- this is required for X11 */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -- PLATFORM-SPECIFIC INTERFACE FUNCTION -------------------------------------------------- */
|
/* -- PLATFORM-SPECIFIC INTERFACE FUNCTION -------------------------------------------------- */
|
||||||
|
@ -85,7 +85,7 @@ void fgPlatformCheckMenuDeactivate(HWND newFocusWnd)
|
|||||||
/* window that got focus was not one of the active menus. That means we'll
|
/* window that got focus was not one of the active menus. That means we'll
|
||||||
* close the active menu's unless the window that got focus was their parent */
|
* close the active menu's unless the window that got focus was their parent */
|
||||||
menu = fgGetActiveMenu();
|
menu = fgGetActiveMenu();
|
||||||
|
|
||||||
if (newFocusWnd != menu->ParentWindow->Window.Handle)
|
if (newFocusWnd != menu->ParentWindow->Window.Handle)
|
||||||
{
|
{
|
||||||
/* focus shifted to another window than the menu's parent, close menus */
|
/* focus shifted to another window than the menu's parent, close menus */
|
||||||
@ -108,6 +108,6 @@ int FGAPIENTRY __glutCreateMenuWithExit( void(* callback)( int ), void (__cdecl
|
|||||||
|
|
||||||
int FGAPIENTRY __glutCreateMenuUcallWithExit(void(*callback)(int, void*), void(__cdecl *exit_function)(int), void* user_data)
|
int FGAPIENTRY __glutCreateMenuUcallWithExit(void(*callback)(int, void*), void(__cdecl *exit_function)(int), void* user_data)
|
||||||
{
|
{
|
||||||
__glutExitFunc = exit_function;
|
__glutExitFunc = exit_function;
|
||||||
return glutCreateMenuUcall(callback, user_data);
|
return glutCreateMenuUcall(callback, user_data);
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* fg_spaceball_mswin.c
|
* fg_spaceball_mswin.c
|
||||||
*
|
*
|
||||||
* Spaceball support for Windows
|
* Spaceball support for Windows
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Stephen J. Baker. All Rights Reserved.
|
* Copyright (c) 2012 Stephen J. Baker. All Rights Reserved.
|
||||||
* Written by Evan Felix <karcaw at gmail.com>
|
* Written by Evan Felix <karcaw at gmail.com>
|
||||||
* Creation date: Sat Feb 4, 2012
|
* Creation date: Sat Feb 4, 2012
|
||||||
@ -32,7 +32,7 @@
|
|||||||
/*
|
/*
|
||||||
* Modified by Jinrong Xie <stonexjr at gmail.com> 12/24/2014
|
* Modified by Jinrong Xie <stonexjr at gmail.com> 12/24/2014
|
||||||
* for Space Navigator support on Windows.
|
* for Space Navigator support on Windows.
|
||||||
* This code is enhanced by at least supporting 3Dconnexion's
|
* This code is enhanced by at least supporting 3Dconnexion's
|
||||||
* six degree of freedom navigator.
|
* six degree of freedom navigator.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -43,7 +43,7 @@
|
|||||||
#include "../fg_internal.h"
|
#include "../fg_internal.h"
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
SPNAV_EVENT_ANY,
|
SPNAV_EVENT_ANY,
|
||||||
SPNAV_EVENT_MOTION_TRANSLATION,
|
SPNAV_EVENT_MOTION_TRANSLATION,
|
||||||
SPNAV_EVENT_MOTION_ROTATION,
|
SPNAV_EVENT_MOTION_ROTATION,
|
||||||
SPNAV_EVENT_BUTTON /* includes both press and release */
|
SPNAV_EVENT_BUTTON /* includes both press and release */
|
||||||
@ -55,145 +55,145 @@ RAWINPUTDEVICE __fgSpaceball = { 0x01, 0x08, 0x00, 0x00 };
|
|||||||
|
|
||||||
void fgPlatformInitializeSpaceball(void)
|
void fgPlatformInitializeSpaceball(void)
|
||||||
{
|
{
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
sball_initialized = 1;
|
sball_initialized = 1;
|
||||||
if (!fgStructure.CurrentWindow)
|
if (!fgStructure.CurrentWindow)
|
||||||
{
|
{
|
||||||
sball_initialized = 0;
|
sball_initialized = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
hwnd = fgStructure.CurrentWindow->Window.Handle;
|
hwnd = fgStructure.CurrentWindow->Window.Handle;
|
||||||
|
|
||||||
{
|
{
|
||||||
BOOL ok;
|
BOOL ok;
|
||||||
UINT cbSize = sizeof(__fgSpaceball);
|
UINT cbSize = sizeof(__fgSpaceball);
|
||||||
__fgSpaceball.hwndTarget = hwnd;
|
__fgSpaceball.hwndTarget = hwnd;
|
||||||
ok = RegisterRawInputDevices(&__fgSpaceball, 1, cbSize);
|
ok = RegisterRawInputDevices(&__fgSpaceball, 1, cbSize);
|
||||||
|
|
||||||
if (!ok){
|
if (!ok){
|
||||||
__fgSpaceball.hwndTarget = NULL;
|
__fgSpaceball.hwndTarget = NULL;
|
||||||
sball_initialized = 0;
|
sball_initialized = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void fgPlatformSpaceballClose(void)
|
void fgPlatformSpaceballClose(void)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fgPlatformHasSpaceball(void)
|
int fgPlatformHasSpaceball(void)
|
||||||
{
|
{
|
||||||
return __fgSpaceball.hwndTarget ? 1 : 0;
|
return __fgSpaceball.hwndTarget ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fgPlatformSpaceballNumButtons(void)
|
int fgPlatformSpaceballNumButtons(void)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fgPlatformSpaceballSetWindow(SFG_Window *window)
|
void fgPlatformSpaceballSetWindow(SFG_Window *window)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fgIsSpaceballWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
int fgIsSpaceballWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fgSpaceballHandleWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
void fgSpaceballHandleWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
#define LOGITECH_VENDOR_ID 0x46d
|
#define LOGITECH_VENDOR_ID 0x46d
|
||||||
HRAWINPUT hRawInput = (HRAWINPUT)lParam;
|
HRAWINPUT hRawInput = (HRAWINPUT)lParam;
|
||||||
UINT inputCode = (UINT)wParam;
|
UINT inputCode = (UINT)wParam;
|
||||||
UINT size;
|
UINT size;
|
||||||
BYTE *rawInputBuffer;
|
BYTE *rawInputBuffer;
|
||||||
PRAWINPUT pRawInput;
|
PRAWINPUT pRawInput;
|
||||||
UINT res;
|
UINT res;
|
||||||
RID_DEVICE_INFO sRidDeviceInfo;
|
RID_DEVICE_INFO sRidDeviceInfo;
|
||||||
|
|
||||||
if (!sball_initialized)
|
if (!sball_initialized)
|
||||||
{
|
{
|
||||||
fgPlatformInitializeSpaceball();
|
fgPlatformInitializeSpaceball();
|
||||||
if (!sball_initialized)
|
if (!sball_initialized)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
res = GetRawInputData(hRawInput, RID_INPUT, NULL, &size, sizeof(RAWINPUTHEADER));
|
res = GetRawInputData(hRawInput, RID_INPUT, NULL, &size, sizeof(RAWINPUTHEADER));
|
||||||
if (res == -1)
|
if (res == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
rawInputBuffer = malloc(size * sizeof *rawInputBuffer);
|
rawInputBuffer = malloc(size * sizeof *rawInputBuffer);
|
||||||
pRawInput = (PRAWINPUT)rawInputBuffer;
|
pRawInput = (PRAWINPUT)rawInputBuffer;
|
||||||
|
|
||||||
res = GetRawInputData(hRawInput, RID_INPUT, pRawInput, &size, sizeof(RAWINPUTHEADER));
|
res = GetRawInputData(hRawInput, RID_INPUT, pRawInput, &size, sizeof(RAWINPUTHEADER));
|
||||||
if (res == -1)
|
if (res == -1)
|
||||||
return;
|
return;
|
||||||
if (pRawInput->header.dwType != RIM_TYPEHID)
|
if (pRawInput->header.dwType != RIM_TYPEHID)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sRidDeviceInfo.cbSize = sizeof(RID_DEVICE_INFO);
|
sRidDeviceInfo.cbSize = sizeof(RID_DEVICE_INFO);
|
||||||
size = sizeof(RID_DEVICE_INFO);
|
size = sizeof(RID_DEVICE_INFO);
|
||||||
res = GetRawInputDeviceInfo(pRawInput->header.hDevice, RIDI_DEVICEINFO, &sRidDeviceInfo, &size);
|
res = GetRawInputDeviceInfo(pRawInput->header.hDevice, RIDI_DEVICEINFO, &sRidDeviceInfo, &size);
|
||||||
if (res == -1)
|
if (res == -1)
|
||||||
return;
|
return;
|
||||||
{
|
{
|
||||||
SFG_Window* window = fgWindowByHandle(hwnd);
|
SFG_Window* window = fgWindowByHandle(hwnd);
|
||||||
if ((window == NULL))
|
if ((window == NULL))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (sRidDeviceInfo.hid.dwVendorId == LOGITECH_VENDOR_ID)
|
if (sRidDeviceInfo.hid.dwVendorId == LOGITECH_VENDOR_ID)
|
||||||
{
|
{
|
||||||
// Motion data comes in two parts: motion type and
|
// Motion data comes in two parts: motion type and
|
||||||
// displacement/rotation along three axis.
|
// displacement/rotation along three axis.
|
||||||
// Orientation is a right handed coordinate system with
|
// Orientation is a right handed coordinate system with
|
||||||
// X goes right, Y goes up and Z goes towards viewer, e.g.
|
// X goes right, Y goes up and Z goes towards viewer, e.g.
|
||||||
// the one used in OpenGL
|
// the one used in OpenGL
|
||||||
if (pRawInput->data.hid.bRawData[0] ==
|
if (pRawInput->data.hid.bRawData[0] ==
|
||||||
SPNAV_EVENT_MOTION_TRANSLATION)
|
SPNAV_EVENT_MOTION_TRANSLATION)
|
||||||
{ // Translation vector
|
{ // Translation vector
|
||||||
short* pnData = (short*)(&pRawInput->data.hid.bRawData[1]);
|
short* pnData = (short*)(&pRawInput->data.hid.bRawData[1]);
|
||||||
short X = pnData[0];
|
short X = pnData[0];
|
||||||
short Y = -pnData[2];
|
short Y = -pnData[2];
|
||||||
short Z = pnData[1];
|
short Z = pnData[1];
|
||||||
INVOKE_WCB(*window, SpaceMotion, (X, Y, Z));
|
INVOKE_WCB(*window, SpaceMotion, (X, Y, Z));
|
||||||
}
|
}
|
||||||
else if (pRawInput->data.hid.bRawData[0] ==
|
else if (pRawInput->data.hid.bRawData[0] ==
|
||||||
SPNAV_EVENT_MOTION_ROTATION)
|
SPNAV_EVENT_MOTION_ROTATION)
|
||||||
{ // Axis aligned rotation vector
|
{ // Axis aligned rotation vector
|
||||||
short* pnData = (short*)(&pRawInput->data.hid.bRawData[1]);
|
short* pnData = (short*)(&pRawInput->data.hid.bRawData[1]);
|
||||||
short rX = pnData[0];
|
short rX = pnData[0];
|
||||||
short rY = -pnData[2];
|
short rY = -pnData[2];
|
||||||
short rZ = pnData[1];
|
short rZ = pnData[1];
|
||||||
INVOKE_WCB(*window, SpaceRotation, (rX, rY, rZ));
|
INVOKE_WCB(*window, SpaceRotation, (rX, rY, rZ));
|
||||||
}
|
}
|
||||||
else if (pRawInput->data.hid.bRawData[0] ==
|
else if (pRawInput->data.hid.bRawData[0] ==
|
||||||
SPNAV_EVENT_BUTTON)
|
SPNAV_EVENT_BUTTON)
|
||||||
{ // State of the keys
|
{ // State of the keys
|
||||||
unsigned long dwKeystate = *(unsigned long*)(&pRawInput->data.hid.bRawData[1]);
|
unsigned long dwKeystate = *(unsigned long*)(&pRawInput->data.hid.bRawData[1]);
|
||||||
unsigned int state = GLUT_UP;
|
unsigned int state = GLUT_UP;
|
||||||
if (FETCH_WCB(*window, SpaceButton))
|
if (FETCH_WCB(*window, SpaceButton))
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 32; i++)
|
for (i = 0; i < 32; i++)
|
||||||
{
|
{
|
||||||
unsigned long stateBefore = __fgSpaceKeystate&(1 << i);
|
unsigned long stateBefore = __fgSpaceKeystate&(1 << i);
|
||||||
unsigned long stateNow = dwKeystate&(1 << i);
|
unsigned long stateNow = dwKeystate&(1 << i);
|
||||||
|
|
||||||
if (stateBefore && !stateNow)
|
if (stateBefore && !stateNow)
|
||||||
INVOKE_WCB(*window, SpaceButton, (stateBefore, GLUT_UP));
|
INVOKE_WCB(*window, SpaceButton, (stateBefore, GLUT_UP));
|
||||||
if (!stateBefore && stateNow)
|
if (!stateBefore && stateNow)
|
||||||
INVOKE_WCB(*window, SpaceButton, (stateNow, GLUT_DOWN));
|
INVOKE_WCB(*window, SpaceButton, (stateNow, GLUT_DOWN));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
__fgSpaceKeystate = dwKeystate;
|
__fgSpaceKeystate = dwKeystate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -32,7 +32,7 @@
|
|||||||
extern GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly,
|
extern GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly,
|
||||||
unsigned char layer_type );
|
unsigned char layer_type );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Helper functions for getting client area from the window rect
|
* Helper functions for getting client area from the window rect
|
||||||
* and the window rect from the client area given the style of the window
|
* and the window rect from the client area given the style of the window
|
||||||
* (or a valid window pointer from which the style can be queried).
|
* (or a valid window pointer from which the style can be queried).
|
||||||
@ -146,7 +146,7 @@ int fgPlatformGlutGet ( GLenum eWhat )
|
|||||||
HDC hdc = fgStructure.CurrentWindow->Window.pContext.Device;
|
HDC hdc = fgStructure.CurrentWindow->Window.pContext.Device;
|
||||||
int iPixelFormat = GetPixelFormat( hdc );
|
int iPixelFormat = GetPixelFormat( hdc );
|
||||||
DescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
|
DescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
|
||||||
|
|
||||||
returnValue = pfd.cColorBits;
|
returnValue = pfd.cColorBits;
|
||||||
if (pfd.iPixelType==PFD_TYPE_RGBA)
|
if (pfd.iPixelType==PFD_TYPE_RGBA)
|
||||||
returnValue += pfd.cAlphaBits;
|
returnValue += pfd.cAlphaBits;
|
||||||
@ -183,7 +183,7 @@ int fgPlatformGlutGet ( GLenum eWhat )
|
|||||||
GetWindowRect( fgStructure.CurrentWindow->Window.Handle, &winRect);
|
GetWindowRect( fgStructure.CurrentWindow->Window.Handle, &winRect);
|
||||||
#else
|
#else
|
||||||
ClientToScreen(fgStructure.CurrentWindow->Window.Handle, &topLeft);
|
ClientToScreen(fgStructure.CurrentWindow->Window.Handle, &topLeft);
|
||||||
|
|
||||||
if (fgStructure.CurrentWindow->Parent)
|
if (fgStructure.CurrentWindow->Parent)
|
||||||
/* For child window, we should return relative to upper-left
|
/* For child window, we should return relative to upper-left
|
||||||
* of parent's client area.
|
* of parent's client area.
|
||||||
@ -257,7 +257,7 @@ int fgPlatformGlutGet ( GLenum eWhat )
|
|||||||
*/
|
*/
|
||||||
borderWidth = ((winRect.right-winRect.left)-(clientRect.right-clientRect.left))/2;
|
borderWidth = ((winRect.right-winRect.left)-(clientRect.right-clientRect.left))/2;
|
||||||
captionHeight = (winRect.bottom-winRect.top)-(clientRect.bottom-clientRect.top)-borderWidth; /* include top border in caption height */
|
captionHeight = (winRect.bottom-winRect.top)-(clientRect.bottom-clientRect.top)-borderWidth; /* include top border in caption height */
|
||||||
|
|
||||||
switch( eWhat )
|
switch( eWhat )
|
||||||
{
|
{
|
||||||
case GLUT_WINDOW_BORDER_WIDTH:
|
case GLUT_WINDOW_BORDER_WIDTH:
|
||||||
@ -289,7 +289,7 @@ int fgPlatformGlutGet ( GLenum eWhat )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ static void fghFillPFD( PIXELFORMATDESCRIPTOR *ppfd, HDC hdc, unsigned char laye
|
|||||||
ppfd->dwLayerMask = 0;
|
ppfd->dwLayerMask = 0;
|
||||||
ppfd->dwVisibleMask = 0;
|
ppfd->dwVisibleMask = 0;
|
||||||
ppfd->dwDamageMask = 0;
|
ppfd->dwDamageMask = 0;
|
||||||
|
|
||||||
ppfd->cColorBits = (BYTE) GetDeviceCaps( hdc, BITSPIXEL );
|
ppfd->cColorBits = (BYTE) GetDeviceCaps( hdc, BITSPIXEL );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,7 +291,7 @@ GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly,
|
|||||||
/* windows hack for multismapling/sRGB */
|
/* windows hack for multismapling/sRGB */
|
||||||
if ( ( fgState.DisplayMode & GLUT_MULTISAMPLE ) ||
|
if ( ( fgState.DisplayMode & GLUT_MULTISAMPLE ) ||
|
||||||
( fgState.DisplayMode & GLUT_SRGB ) )
|
( fgState.DisplayMode & GLUT_SRGB ) )
|
||||||
{
|
{
|
||||||
HGLRC rc, rc_before=wglGetCurrentContext();
|
HGLRC rc, rc_before=wglGetCurrentContext();
|
||||||
HWND hWnd;
|
HWND hWnd;
|
||||||
HDC hDC, hDC_before=wglGetCurrentDC();
|
HDC hDC, hDC_before=wglGetCurrentDC();
|
||||||
@ -430,7 +430,7 @@ void fghComputeWindowRectFromClientArea_UseStyle( RECT *clientRect, const DWORD
|
|||||||
windowRect.left = clientRect->left;
|
windowRect.left = clientRect->left;
|
||||||
windowRect.top = clientRect->top;
|
windowRect.top = clientRect->top;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* done, copy windowRect to output */
|
/* done, copy windowRect to output */
|
||||||
CopyRect(clientRect,&windowRect);
|
CopyRect(clientRect,&windowRect);
|
||||||
}
|
}
|
||||||
@ -467,7 +467,7 @@ void fghGetClientArea( RECT *clientRect, const SFG_Window *window, BOOL posIsOut
|
|||||||
POINT topLeftClient = {0,0};
|
POINT topLeftClient = {0,0};
|
||||||
|
|
||||||
freeglut_return_if_fail((window && window->Window.Handle));
|
freeglut_return_if_fail((window && window->Window.Handle));
|
||||||
|
|
||||||
/* Get size of client rect */
|
/* Get size of client rect */
|
||||||
GetClientRect(window->Window.Handle, clientRect);
|
GetClientRect(window->Window.Handle, clientRect);
|
||||||
if (posIsOutside)
|
if (posIsOutside)
|
||||||
@ -497,9 +497,9 @@ typedef struct
|
|||||||
} m_proc_t;
|
} m_proc_t;
|
||||||
|
|
||||||
static BOOL CALLBACK m_proc(HMONITOR mon,
|
static BOOL CALLBACK m_proc(HMONITOR mon,
|
||||||
HDC hdc,
|
HDC hdc,
|
||||||
LPRECT rect,
|
LPRECT rect,
|
||||||
LPARAM data)
|
LPARAM data)
|
||||||
{
|
{
|
||||||
m_proc_t *dp=(m_proc_t *)data;
|
m_proc_t *dp=(m_proc_t *)data;
|
||||||
MONITORINFOEX info;
|
MONITORINFOEX info;
|
||||||
@ -518,7 +518,7 @@ static BOOL CALLBACK m_proc(HMONITOR mon,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* this function returns the origin of the screen identified by
|
* this function returns the origin of the screen identified by
|
||||||
* fgDisplay.pDisplay.DisplayName, and 0 otherwise.
|
* fgDisplay.pDisplay.DisplayName, and 0 otherwise.
|
||||||
* This is used in fgOpenWindow to open the gamemode window on the screen
|
* This is used in fgOpenWindow to open the gamemode window on the screen
|
||||||
@ -727,9 +727,9 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title,
|
|||||||
|
|
||||||
/* Enable multitouch: additional flag TWF_FINETOUCH, TWF_WANTPALM */
|
/* Enable multitouch: additional flag TWF_FINETOUCH, TWF_WANTPALM */
|
||||||
#ifdef WM_TOUCH
|
#ifdef WM_TOUCH
|
||||||
if (fghRegisterTouchWindow == (pRegisterTouchWindow)0xDEADBEEF)
|
if (fghRegisterTouchWindow == (pRegisterTouchWindow)0xDEADBEEF)
|
||||||
fghRegisterTouchWindow = (pRegisterTouchWindow)GetProcAddress(GetModuleHandle("user32"),"RegisterTouchWindow");
|
fghRegisterTouchWindow = (pRegisterTouchWindow)GetProcAddress(GetModuleHandle("user32"),"RegisterTouchWindow");
|
||||||
if (fghRegisterTouchWindow)
|
if (fghRegisterTouchWindow)
|
||||||
fghRegisterTouchWindow( window->Window.Handle, TWF_FINETOUCH | TWF_WANTPALM );
|
fghRegisterTouchWindow( window->Window.Handle, TWF_FINETOUCH | TWF_WANTPALM );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user