added error check (John Fay)
[freeglut] / src / freeglut_state.c
index 68b7eb5..c972713 100644 (file)
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <GL/freeglut.h>
 #include "freeglut_internal.h"
 
@@ -72,7 +68,7 @@ static int fghGetConfig( int attribute )
  */
 void FGAPIENTRY glutSetOption( GLenum eWhat, int value )
 {
-    freeglut_assert_ready;
+    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSetOption" );
 
     /*
      * XXX In chronological code add order.  (WHY in that order?)
@@ -142,7 +138,7 @@ int FGAPIENTRY glutGet( GLenum eWhat )
         return fgElapsedTime();
     }
 
-    freeglut_assert_ready;
+    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutGet" );
 
     /* XXX In chronological code add order.  (WHY in that order?) */
     switch( eWhat )
@@ -465,7 +461,7 @@ int FGAPIENTRY glutGet( GLenum eWhat )
  */
 int FGAPIENTRY glutDeviceGet( GLenum eWhat )
 {
-    freeglut_assert_ready;
+    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutDeviceGet" );
 
     /* XXX WARNING: we are mostly lying in this function. */
     switch( eWhat )
@@ -537,7 +533,7 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat )
     case GLUT_JOYSTICK_POLL_RATE:
         return fgStructure.Window ? fgStructure.Window->State.JoystickPollRate : 0;
 
-    /* The following two are only for Joystick 0 but this is an improvement */
+    /* XXX The following two are only for Joystick 0 but this is an improvement */
     case GLUT_JOYSTICK_BUTTONS:
         return glutJoystickGetNumButtons ( 0 );
 
@@ -575,6 +571,7 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat )
  */
 int FGAPIENTRY glutGetModifiers( void )
 {
+    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutGetModifiers" );
     if( fgState.Modifiers == 0xffffffff )
     {
         fgWarning( "glutGetModifiers() called outside an input callback" );
@@ -589,7 +586,7 @@ int FGAPIENTRY glutGetModifiers( void )
  */
 int FGAPIENTRY glutLayerGet( GLenum eWhat )
 {
-    freeglut_assert_ready;
+    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutLayerGet" );
 
     /*
      * This is easy as layers are not implemented ;-)