Don't run indent on the Xcode templates
authorSam Lantinga <slouken@libsdl.org>
Sat, 11 Aug 2007 18:51:12 +0000
changeset 22204d2d0548f5b2
parent 2219 f6099efa3f0b
child 2221 1d75c38e1e5c
Don't run indent on the Xcode templates
Makefile.in
Xcode/SDLTest/libsdlmain_prefix.h
Xcode/TemplatesForProjectBuilder/SDL Application/SDLMain.h
Xcode/TemplatesForProjectBuilder/SDL Application/main.c
Xcode/TemplatesForProjectBuilder/SDL Cocoa Application/SDLMain.h
Xcode/TemplatesForProjectBuilder/SDL Cocoa Application/main.c
Xcode/TemplatesForProjectBuilder/SDL Custom Cocoa Application/MyController.h
Xcode/TemplatesForProjectBuilder/SDL Custom Cocoa Application/MyCustomView.h
Xcode/TemplatesForProjectBuilder/SDL Custom Cocoa Application/MyCustomWindow.h
Xcode/TemplatesForProjectBuilder/SDL Custom Cocoa Application/SDLMain.h
Xcode/TemplatesForProjectBuilder/SDL Custom Cocoa Application/prefix.h
Xcode/TemplatesForProjectBuilder/SDL OpenGL Application/SDLMain.h
Xcode/TemplatesForProjectBuilder/SDL OpenGL Application/atlantis/atlantis.c
Xcode/TemplatesForProjectBuilder/SDL OpenGL Application/atlantis/atlantis.h
Xcode/TemplatesForProjectBuilder/SDL OpenGL Application/atlantis/swim.c
Xcode/TemplatesForProjectBuilder/SDL OpenGL Application/main.c
Xcode/TemplatesForXcode/SDL Application/SDLMain.h
Xcode/TemplatesForXcode/SDL Application/main.c
Xcode/TemplatesForXcode/SDL Cocoa Application/SDLMain.h
Xcode/TemplatesForXcode/SDL Cocoa Application/main.c
Xcode/TemplatesForXcode/SDL Custom Cocoa Application/MyController.h
Xcode/TemplatesForXcode/SDL Custom Cocoa Application/MyCustomView.h
Xcode/TemplatesForXcode/SDL Custom Cocoa Application/MyCustomWindow.h
Xcode/TemplatesForXcode/SDL Custom Cocoa Application/SDLMain.h
Xcode/TemplatesForXcode/SDL OpenGL Application/SDLMain.h
Xcode/TemplatesForXcode/SDL OpenGL Application/atlantis/atlantis.c
Xcode/TemplatesForXcode/SDL OpenGL Application/atlantis/atlantis.h
Xcode/TemplatesForXcode/SDL OpenGL Application/atlantis/swim.c
Xcode/TemplatesForXcode/SDL OpenGL Application/main.c
     1.1 --- a/Makefile.in	Fri Aug 10 16:03:35 2007 +0000
     1.2 +++ b/Makefile.in	Sat Aug 11 18:51:12 2007 +0000
     1.3 @@ -177,7 +177,7 @@
     1.4  	    -name '*.h' -o \
     1.5  	    -name '*.c' -o \
     1.6  	    -name '*.cc' \) \
     1.7 -	    -print | \
     1.8 +	    -print | fgrep -v ./Xcode | \
     1.9  	while read file; do \
    1.10  	    indent "$$file" -o "$$file.indent"; \
    1.11  	    if cmp "$$file" "$$file.indent" >/dev/null; then \
     2.1 --- a/Xcode/SDLTest/libsdlmain_prefix.h	Fri Aug 10 16:03:35 2007 +0000
     2.2 +++ b/Xcode/SDLTest/libsdlmain_prefix.h	Sat Aug 11 18:51:12 2007 +0000
     2.3 @@ -10,4 +10,4 @@
     2.4  #include <Cocoa/Cocoa.h>
     2.5  #include <Carbon/Carbon.h>
     2.6  #include "SDL.h"
     2.7 -#include "SDLMain.h"
     2.8 +#include "SDLMain.h"
     2.9 \ No newline at end of file
     3.1 --- a/Xcode/TemplatesForProjectBuilder/SDL Application/SDLMain.h	Fri Aug 10 16:03:35 2007 +0000
     3.2 +++ b/Xcode/TemplatesForProjectBuilder/SDL Application/SDLMain.h	Sat Aug 11 18:51:12 2007 +0000
     3.3 @@ -7,4 +7,5 @@
     3.4  
     3.5  #import <Cocoa/Cocoa.h>
     3.6  
     3.7 -@ interface SDLMain:NSObject @ end
     3.8 +@interface SDLMain : NSObject
     3.9 +@end
     4.1 --- a/Xcode/TemplatesForProjectBuilder/SDL Application/main.c	Fri Aug 10 16:03:35 2007 +0000
     4.2 +++ b/Xcode/TemplatesForProjectBuilder/SDL Application/main.c	Sat Aug 11 18:51:12 2007 +0000
     4.3 @@ -4,7 +4,7 @@
     4.4     Please see the SDL documentation for details on using the SDL API:
     4.5     /Developer/Documentation/SDL/docs.html
     4.6  */
     4.7 -
     4.8 +   
     4.9  #include <stdio.h>
    4.10  #include <stdlib.h>
    4.11  #include <string.h>
    4.12 @@ -12,54 +12,54 @@
    4.13  
    4.14  #include "SDL.h"
    4.15  
    4.16 -int
    4.17 -main(int argc, char *argv[])
    4.18 +int main(int argc, char *argv[])
    4.19  {
    4.20 -    Uint32 initflags = SDL_INIT_VIDEO;  /* See documentation for details */
    4.21 -    SDL_Surface *screen;
    4.22 -    Uint8 video_bpp = 0;
    4.23 -    Uint32 videoflags = SDL_SWSURFACE;
    4.24 -    int done;
    4.25 -    SDL_Event event;
    4.26 +	Uint32 initflags = SDL_INIT_VIDEO;  /* See documentation for details */
    4.27 +	SDL_Surface *screen;
    4.28 +	Uint8  video_bpp = 0;
    4.29 +	Uint32 videoflags = SDL_SWSURFACE;
    4.30 +	int    done;
    4.31 +        SDL_Event event;
    4.32  
    4.33 -    /* Initialize the SDL library */
    4.34 -    if (SDL_Init(initflags) < 0) {
    4.35 -        fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
    4.36 -        exit(1);
    4.37 -    }
    4.38 +	/* Initialize the SDL library */
    4.39 +	if ( SDL_Init(initflags) < 0 ) {
    4.40 +		fprintf(stderr, "Couldn't initialize SDL: %s\n",
    4.41 +			SDL_GetError());
    4.42 +		exit(1);
    4.43 +	}
    4.44  
    4.45 -    /* Set 640x480 video mode */
    4.46 -    screen = SDL_SetVideoMode(640, 480, video_bpp, videoflags);
    4.47 -    if (screen == NULL) {
    4.48 -        fprintf(stderr, "Couldn't set 640x480x%d video mode: %s\n",
    4.49 -                video_bpp, SDL_GetError());
    4.50 -        SDL_Quit();
    4.51 -        exit(2);
    4.52 -    }
    4.53 +	/* Set 640x480 video mode */
    4.54 +	screen=SDL_SetVideoMode(640,480, video_bpp, videoflags);
    4.55 +        if (screen == NULL) {
    4.56 +		fprintf(stderr, "Couldn't set 640x480x%d video mode: %s\n",
    4.57 +                        video_bpp, SDL_GetError());
    4.58 +		SDL_Quit();
    4.59 +		exit(2);
    4.60 +	}
    4.61  
    4.62 -    done = 0;
    4.63 -    while (!done) {
    4.64 +	done = 0;
    4.65 +	while ( !done ) {
    4.66  
    4.67 -        /* Check for events */
    4.68 -        while (SDL_PollEvent(&event)) {
    4.69 -            switch (event.type) {
    4.70 +		/* Check for events */
    4.71 +		while ( SDL_PollEvent(&event) ) {
    4.72 +			switch (event.type) {
    4.73  
    4.74 -            case SDL_MOUSEMOTION:
    4.75 -                break;
    4.76 -            case SDL_MOUSEBUTTONDOWN:
    4.77 -                break;
    4.78 -            case SDL_KEYDOWN:
    4.79 -                /* Any keypress quits the app... */
    4.80 -            case SDL_QUIT:
    4.81 -                done = 1;
    4.82 -                break;
    4.83 -            default:
    4.84 -                break;
    4.85 -            }
    4.86 -        }
    4.87 -    }
    4.88 -
    4.89 -    /* Clean up the SDL library */
    4.90 -    SDL_Quit();
    4.91 -    return (0);
    4.92 +				case SDL_MOUSEMOTION:
    4.93 +					break;
    4.94 +				case SDL_MOUSEBUTTONDOWN:
    4.95 +					break;
    4.96 +				case SDL_KEYDOWN:
    4.97 +					/* Any keypress quits the app... */
    4.98 +				case SDL_QUIT:
    4.99 +					done = 1;
   4.100 +					break;
   4.101 +				default:
   4.102 +					break;
   4.103 +			}
   4.104 +		}
   4.105 +	}
   4.106 +	
   4.107 +	/* Clean up the SDL library */
   4.108 +	SDL_Quit();
   4.109 +	return(0);
   4.110  }
     5.1 --- a/Xcode/TemplatesForProjectBuilder/SDL Cocoa Application/SDLMain.h	Fri Aug 10 16:03:35 2007 +0000
     5.2 +++ b/Xcode/TemplatesForProjectBuilder/SDL Cocoa Application/SDLMain.h	Sat Aug 11 18:51:12 2007 +0000
     5.3 @@ -7,10 +7,11 @@
     5.4  
     5.5  #import <Cocoa/Cocoa.h>
     5.6  
     5.7 -@ interface SDLMain: NSObject - (IBAction) prefsMenu:(id) sender;
     5.8 --(IBAction) newGame:(id) sender;
     5.9 --(IBAction) openGame:(id) sender;
    5.10 --(IBAction) saveGame:(id) sender;
    5.11 --(IBAction) saveGameAs:(id) sender;
    5.12 --(IBAction) help:(id) sender;
    5.13 +@interface SDLMain : NSObject
    5.14 +- (IBAction)prefsMenu:(id)sender;
    5.15 +- (IBAction)newGame:(id)sender;
    5.16 +- (IBAction)openGame:(id)sender;
    5.17 +- (IBAction)saveGame:(id)sender;
    5.18 +- (IBAction)saveGameAs:(id)sender;
    5.19 +- (IBAction)help:(id)sender;
    5.20  @end
     6.1 --- a/Xcode/TemplatesForProjectBuilder/SDL Cocoa Application/main.c	Fri Aug 10 16:03:35 2007 +0000
     6.2 +++ b/Xcode/TemplatesForProjectBuilder/SDL Cocoa Application/main.c	Sat Aug 11 18:51:12 2007 +0000
     6.3 @@ -4,7 +4,7 @@
     6.4     Please see the SDL documentation for details on using the SDL API:
     6.5     /Developer/Documentation/SDL/docs.html
     6.6  */
     6.7 -
     6.8 +   
     6.9  #include <stdio.h>
    6.10  #include <stdlib.h>
    6.11  #include <string.h>
    6.12 @@ -12,54 +12,54 @@
    6.13  
    6.14  #include "SDL.h"
    6.15  
    6.16 -int
    6.17 -main(int argc, char *argv[])
    6.18 +int main(int argc, char *argv[])
    6.19  {
    6.20 -    Uint32 initflags = SDL_INIT_VIDEO;  /* See documentation for details */
    6.21 -    SDL_Surface *screen;
    6.22 -    Uint8 video_bpp = 0;
    6.23 -    Uint32 videoflags = SDL_SWSURFACE;
    6.24 -    int done;
    6.25 -    SDL_Event event;
    6.26 +	Uint32 initflags = SDL_INIT_VIDEO;  /* See documentation for details */
    6.27 +	SDL_Surface *screen;
    6.28 +	Uint8  video_bpp = 0;
    6.29 +	Uint32 videoflags = SDL_SWSURFACE;
    6.30 +	int    done;
    6.31 +        SDL_Event event;
    6.32  
    6.33 -    /* Initialize the SDL library */
    6.34 -    if (SDL_Init(initflags) < 0) {
    6.35 -        fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
    6.36 -        exit(1);
    6.37 -    }
    6.38 +	/* Initialize the SDL library */
    6.39 +	if ( SDL_Init(initflags) < 0 ) {
    6.40 +		fprintf(stderr, "Couldn't initialize SDL: %s\n",
    6.41 +			SDL_GetError());
    6.42 +		exit(1);
    6.43 +	}
    6.44  
    6.45 -    /* Set 640x480 video mode */
    6.46 -    screen = SDL_SetVideoMode(640, 480, video_bpp, videoflags);
    6.47 -    if (screen == NULL) {
    6.48 -        fprintf(stderr, "Couldn't set 640x480x%d video mode: %s\n",
    6.49 -                video_bpp, SDL_GetError());
    6.50 -        SDL_Quit();
    6.51 -        exit(2);
    6.52 -    }
    6.53 +	/* Set 640x480 video mode */
    6.54 +	screen=SDL_SetVideoMode(640,480, video_bpp, videoflags);
    6.55 +        if (screen == NULL) {
    6.56 +		fprintf(stderr, "Couldn't set 640x480x%d video mode: %s\n",
    6.57 +                        video_bpp, SDL_GetError());
    6.58 +		SDL_Quit();
    6.59 +		exit(2);
    6.60 +	}
    6.61  
    6.62 -    done = 0;
    6.63 -    while (!done) {
    6.64 +	done = 0;
    6.65 +	while ( !done ) {
    6.66  
    6.67 -        /* Check for events */
    6.68 -        while (SDL_PollEvent(&event)) {
    6.69 -            switch (event.type) {
    6.70 +		/* Check for events */
    6.71 +		while ( SDL_PollEvent(&event) ) {
    6.72 +			switch (event.type) {
    6.73  
    6.74 -            case SDL_MOUSEMOTION:
    6.75 -                break;
    6.76 -            case SDL_MOUSEBUTTONDOWN:
    6.77 -                break;
    6.78 -            case SDL_KEYDOWN:
    6.79 -                /* Any keypress quits the app... */
    6.80 -            case SDL_QUIT:
    6.81 -                done = 1;
    6.82 -                break;
    6.83 -            default:
    6.84 -                break;
    6.85 -            }
    6.86 -        }
    6.87 -    }
    6.88 -
    6.89 -    /* Clean up the SDL library */
    6.90 -    SDL_Quit();
    6.91 -    return (0);
    6.92 +				case SDL_MOUSEMOTION:
    6.93 +					break;
    6.94 +				case SDL_MOUSEBUTTONDOWN:
    6.95 +					break;
    6.96 +				case SDL_KEYDOWN:
    6.97 +					/* Any keypress quits the app... */
    6.98 +				case SDL_QUIT:
    6.99 +					done = 1;
   6.100 +					break;
   6.101 +				default:
   6.102 +					break;
   6.103 +			}
   6.104 +		}
   6.105 +	}
   6.106 +	
   6.107 +	/* Clean up the SDL library */
   6.108 +	SDL_Quit();
   6.109 +	return(0);
   6.110  }
     7.1 --- a/Xcode/TemplatesForProjectBuilder/SDL Custom Cocoa Application/MyController.h	Fri Aug 10 16:03:35 2007 +0000
     7.2 +++ b/Xcode/TemplatesForProjectBuilder/SDL Custom Cocoa Application/MyController.h	Sat Aug 11 18:51:12 2007 +0000
     7.3 @@ -9,35 +9,38 @@
     7.4  #import <Cocoa/Cocoa.h>
     7.5  #import "SDL.h"
     7.6  
     7.7 -extern id gController;          // instance of this class from nib
     7.8 +extern id gController; // instance of this class from nib
     7.9  
    7.10  // Declare SDL_QuartzWindowDelegate (defined in SDL.framework)
    7.11 -@interface SDL_QuartzWindowDelegate: NSObject @ end @ interface MyController:NSObject
    7.12 +@interface SDL_QuartzWindowDelegate : NSObject
    7.13 +@end
    7.14 +
    7.15 +@interface MyController : NSObject
    7.16  {
    7.17      // Interface Builder Outlets
    7.18 -    IBOutlet id _framesPerSecond;
    7.19 -    IBOutlet id _numSprites;
    7.20 -    IBOutlet id _window;
    7.21 -    IBOutlet id _view;
    7.22 +    IBOutlet id 	_framesPerSecond;
    7.23 +    IBOutlet id 	_numSprites;
    7.24 +    IBOutlet id 	_window;
    7.25 +    IBOutlet id 	_view;
    7.26 +    
    7.27 +    // Private instance variables
    7.28 +    int          _nSprites;
    7.29 +    int          _max_speed;
    7.30 +    int          _doFlip;
    7.31 +    Uint8*       _mem;
    7.32 +    
    7.33 +    SDL_Surface* _screen;
    7.34 +    SDL_Surface* _sprite;
    7.35 +    SDL_Rect*    _sprite_rects;
    7.36 +    SDL_Rect*    _positions;
    7.37 +    SDL_Rect*    _velocities;
    7.38 +    int          _sprites_visible;
    7.39 +    Uint16       _sprite_w, _sprite_h;
    7.40 +    
    7.41 +    int 		 _mouse_x, _mouse_y;
    7.42 +}
    7.43 +// Interface Builder Actions
    7.44 +- (IBAction)changeNumberOfSprites:(id)sender;
    7.45 +- (IBAction)selectUpdateMode:(id)sender;
    7.46 +@end
    7.47  
    7.48 -    // Private instance variables
    7.49 -    int _nSprites;
    7.50 -    int _max_speed;
    7.51 -    int _doFlip;
    7.52 -    Uint8 *_mem;
    7.53 -
    7.54 -    SDL_Surface *_screen;
    7.55 -    SDL_Surface *_sprite;
    7.56 -    SDL_Rect *_sprite_rects;
    7.57 -    SDL_Rect *_positions;
    7.58 -    SDL_Rect *_velocities;
    7.59 -    int _sprites_visible;
    7.60 -    Uint16 _sprite_w, _sprite_h;
    7.61 -
    7.62 -    int _mouse_x, _mouse_y;
    7.63 -}
    7.64 -
    7.65 -// Interface Builder Actions
    7.66 --(IBAction) changeNumberOfSprites:(id) sender;
    7.67 --(IBAction) selectUpdateMode:(id) sender;
    7.68 -@end
     8.1 --- a/Xcode/TemplatesForProjectBuilder/SDL Custom Cocoa Application/MyCustomView.h	Fri Aug 10 16:03:35 2007 +0000
     8.2 +++ b/Xcode/TemplatesForProjectBuilder/SDL Custom Cocoa Application/MyCustomView.h	Sat Aug 11 18:51:12 2007 +0000
     8.3 @@ -9,7 +9,8 @@
     8.4  #import <AppKit/AppKit.h>
     8.5  
     8.6  
     8.7 -@ interface MyCustomView:NSQuickDrawView {
     8.8 +@interface MyCustomView : NSQuickDrawView
     8.9 +{
    8.10  }
    8.11  
    8.12  @end
     9.1 --- a/Xcode/TemplatesForProjectBuilder/SDL Custom Cocoa Application/MyCustomWindow.h	Fri Aug 10 16:03:35 2007 +0000
     9.2 +++ b/Xcode/TemplatesForProjectBuilder/SDL Custom Cocoa Application/MyCustomWindow.h	Sat Aug 11 18:51:12 2007 +0000
     9.3 @@ -11,11 +11,17 @@
     9.4  // Be a subclass of SDL_QuartzWindow so SDL will
     9.5  // handle the redraw problems when minimizing the window
     9.6  // This class is defined in SDL.framework
     9.7 -@ interface SDL_QuartzWindow:NSWindow @ end
     9.8 +@interface SDL_QuartzWindow : NSWindow
     9.9 +@end
    9.10 +
    9.11  // Also assign SDL_QuartzWindowDelegate to the window
    9.12  // to perform other tasks. You can subclass this delegate
    9.13  // if you want to add your own delegation methods
    9.14  // This class is defined in SDL.framework
    9.15 -@ interface SDL_QuartzWindowDelegate:NSObject @ end
    9.16 +@interface SDL_QuartzWindowDelegate : NSObject
    9.17 +@end
    9.18 +
    9.19  // Declare our custom class
    9.20 -@ interface MyCustomWindow:SDL_QuartzWindow @ end
    9.21 +@interface MyCustomWindow : SDL_QuartzWindow
    9.22 +@end
    9.23 +
    10.1 --- a/Xcode/TemplatesForProjectBuilder/SDL Custom Cocoa Application/SDLMain.h	Fri Aug 10 16:03:35 2007 +0000
    10.2 +++ b/Xcode/TemplatesForProjectBuilder/SDL Custom Cocoa Application/SDLMain.h	Sat Aug 11 18:51:12 2007 +0000
    10.3 @@ -7,8 +7,8 @@
    10.4  
    10.5  #import <Cocoa/Cocoa.h>
    10.6  
    10.7 -@ interface SDLMain:NSObject {
    10.8 +@interface SDLMain : NSObject
    10.9 +{
   10.10      IBOutlet id _controller;
   10.11  }
   10.12 -
   10.13  @end
    11.1 --- a/Xcode/TemplatesForProjectBuilder/SDL Custom Cocoa Application/prefix.h	Fri Aug 10 16:03:35 2007 +0000
    11.2 +++ b/Xcode/TemplatesForProjectBuilder/SDL Custom Cocoa Application/prefix.h	Sat Aug 11 18:51:12 2007 +0000
    11.3 @@ -9,3 +9,4 @@
    11.4  
    11.5  #include <Foundation/Foundation.h>
    11.6  #include <Cocoa/Cocoa.h>
    11.7 +
    12.1 --- a/Xcode/TemplatesForProjectBuilder/SDL OpenGL Application/SDLMain.h	Fri Aug 10 16:03:35 2007 +0000
    12.2 +++ b/Xcode/TemplatesForProjectBuilder/SDL OpenGL Application/SDLMain.h	Sat Aug 11 18:51:12 2007 +0000
    12.3 @@ -7,4 +7,5 @@
    12.4  
    12.5  #import <Cocoa/Cocoa.h>
    12.6  
    12.7 -@ interface SDLMain:NSObject @ end
    12.8 +@interface SDLMain : NSObject
    12.9 +@end
    13.1 --- a/Xcode/TemplatesForProjectBuilder/SDL OpenGL Application/atlantis/atlantis.c	Fri Aug 10 16:03:35 2007 +0000
    13.2 +++ b/Xcode/TemplatesForProjectBuilder/SDL OpenGL Application/atlantis/atlantis.c	Sat Aug 11 18:51:12 2007 +0000
    13.3 @@ -54,49 +54,46 @@
    13.4  
    13.5  int w_win = 640;
    13.6  int h_win = 480;
    13.7 -GLint count = 0;
    13.8 +GLint count  = 0;
    13.9  GLenum StrMode = GL_VENDOR;
   13.10  
   13.11  GLboolean moving;
   13.12  
   13.13 -static double
   13.14 -mtime(void)
   13.15 +static double mtime(void)
   13.16  {
   13.17 -    struct timeval tk_time;
   13.18 -    struct timezone tz;
   13.19 -
   13.20 -    gettimeofday(&tk_time, &tz);
   13.21 -
   13.22 -    return 4294.967296 * tk_time.tv_sec + 0.000001 * tk_time.tv_usec;
   13.23 +   struct timeval tk_time;
   13.24 +   struct timezone tz;
   13.25 +   
   13.26 +   gettimeofday(&tk_time, &tz);
   13.27 +   
   13.28 +   return 4294.967296 * tk_time.tv_sec + 0.000001 * tk_time.tv_usec;
   13.29  }
   13.30  
   13.31 -static double
   13.32 -filter(double in, double *save)
   13.33 +static double filter(double in, double *save)
   13.34  {
   13.35 -    static double k1 = 0.9;
   13.36 -    static double k2 = 0.05;
   13.37 +	static double k1 = 0.9;
   13.38 +	static double k2 = 0.05;
   13.39  
   13.40 -    save[3] = in;
   13.41 -    save[1] = save[0] * k1 + k2 * (save[3] + save[2]);
   13.42 +	save[3] = in;
   13.43 +	save[1] = save[0]*k1 + k2*(save[3] + save[2]);
   13.44  
   13.45 -    save[0] = save[1];
   13.46 -    save[2] = save[3];
   13.47 +	save[0]=save[1];
   13.48 +	save[2]=save[3];
   13.49  
   13.50 -    return (save[1]);
   13.51 +	return(save[1]);
   13.52  }
   13.53  
   13.54 -void
   13.55 -DrawStr(const char *str)
   13.56 +void DrawStr(const char *str)
   13.57  {
   13.58 -    GLint i = 0;
   13.59 -
   13.60 -    if (!str)
   13.61 -        return;
   13.62 -
   13.63 -    while (str[i]) {
   13.64 -        glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, str[i]);
   13.65 -        i++;
   13.66 -    }
   13.67 +	GLint i = 0;
   13.68 +	
   13.69 +	if(!str) return;
   13.70 +        
   13.71 +	while(str[i])
   13.72 +	{
   13.73 +		glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, str[i]);
   13.74 +		i++;
   13.75 +	}
   13.76  }
   13.77  
   13.78  void
   13.79 @@ -137,18 +134,18 @@
   13.80  void
   13.81  Atlantis_Init(void)
   13.82  {
   13.83 -    static float ambient[] = { 0.2, 0.2, 0.2, 1.0 };
   13.84 -    static float diffuse[] = { 1.0, 1.0, 1.0, 1.0 };
   13.85 -    static float position[] = { 0.0, 1.0, 0.0, 0.0 };
   13.86 -    static float mat_shininess[] = { 90.0 };
   13.87 -    static float mat_specular[] = { 0.8, 0.8, 0.8, 1.0 };
   13.88 -    static float mat_diffuse[] = { 0.46, 0.66, 0.795, 1.0 };
   13.89 -    static float mat_ambient[] = { 0.3, 0.4, 0.5, 1.0 };
   13.90 -    static float lmodel_ambient[] = { 0.4, 0.4, 0.4, 1.0 };
   13.91 -    static float lmodel_localviewer[] = { 0.0 };
   13.92 +    static float ambient[] = {0.2, 0.2, 0.2, 1.0};
   13.93 +    static float diffuse[] = {1.0, 1.0, 1.0, 1.0};
   13.94 +    static float position[] = {0.0, 1.0, 0.0, 0.0};
   13.95 +    static float mat_shininess[] = {90.0};
   13.96 +    static float mat_specular[] = {0.8, 0.8, 0.8, 1.0};
   13.97 +    static float mat_diffuse[] = {0.46, 0.66, 0.795, 1.0};
   13.98 +    static float mat_ambient[] = {0.3, 0.4, 0.5, 1.0};
   13.99 +    static float lmodel_ambient[] = {0.4, 0.4, 0.4, 1.0};
  13.100 +    static float lmodel_localviewer[] = {0.0};
  13.101      //GLfloat map1[4] = {0.0, 0.0, 0.0, 0.0};
  13.102      //GLfloat map2[4] = {0.0, 0.0, 0.0, 0.0};
  13.103 -    static float fog_color[] = { 0.0, 0.5, 0.9, 1.0 };
  13.104 +    static float fog_color[] = {0.0, 0.5, 0.9, 1.0};
  13.105  
  13.106      glFrontFace(GL_CCW);
  13.107  
  13.108 @@ -171,9 +168,9 @@
  13.109      InitFishs();
  13.110  
  13.111      glEnable(GL_FOG);
  13.112 -    glFogi(GL_FOG_MODE, GL_EXP);
  13.113 -    glFogf(GL_FOG_DENSITY, 0.0000025);
  13.114 -    glFogfv(GL_FOG_COLOR, fog_color);
  13.115 +	glFogi(GL_FOG_MODE, GL_EXP);
  13.116 +	glFogf(GL_FOG_DENSITY, 0.0000025);
  13.117 +	glFogfv(GL_FOG_COLOR, fog_color);
  13.118  
  13.119      glClearColor(0.0, 0.5, 0.9, 1.0);
  13.120  }
  13.121 @@ -181,15 +178,14 @@
  13.122  void
  13.123  Atlantis_Reshape(int width, int height)
  13.124  {
  13.125 -    w_win = width;
  13.126 -    h_win = height;
  13.127 -
  13.128 +	w_win = width;
  13.129 +	h_win = height;
  13.130 +	
  13.131      glViewport(0, 0, width, height);
  13.132  
  13.133      glMatrixMode(GL_PROJECTION);
  13.134      glLoadIdentity();
  13.135 -    gluPerspective(60.0, (GLfloat) width / (GLfloat) height, 20000.0,
  13.136 -                   300000.0);
  13.137 +    gluPerspective(60.0, (GLfloat) width / (GLfloat) height, 20000.0, 300000.0);
  13.138      glMatrixMode(GL_MODELVIEW);
  13.139  }
  13.140  
  13.141 @@ -216,42 +212,42 @@
  13.142  {
  13.143      switch (key) {
  13.144      case 't':
  13.145 -        Timing = !Timing;
  13.146 -        break;
  13.147 +    	Timing = !Timing;
  13.148 +    break;
  13.149      case ' ':
  13.150 -        switch (StrMode) {
  13.151 -        case GL_EXTENSIONS:
  13.152 -            StrMode = GL_VENDOR;
  13.153 -            break;
  13.154 -        case GL_VENDOR:
  13.155 -            StrMode = GL_RENDERER;
  13.156 -            break;
  13.157 -        case GL_RENDERER:
  13.158 -            StrMode = GL_VERSION;
  13.159 -            break;
  13.160 -        case GL_VERSION:
  13.161 -            StrMode = GL_EXTENSIONS;
  13.162 -            break;
  13.163 -        }
  13.164 -        break;
  13.165 -    case 27:                   /* Esc will quit */
  13.166 +    	switch(StrMode)
  13.167 +    	{
  13.168 +		    case GL_EXTENSIONS:
  13.169 +    			StrMode = GL_VENDOR;
  13.170 +		    break;
  13.171 +		    case GL_VENDOR:
  13.172 +		    	StrMode = GL_RENDERER;
  13.173 +		    break;
  13.174 +		    case GL_RENDERER:
  13.175 +		    	StrMode = GL_VERSION;
  13.176 +		    break;
  13.177 +		    case GL_VERSION:
  13.178 +		    	StrMode = GL_EXTENSIONS;
  13.179 +		    break;
  13.180 +		}
  13.181 +	break;
  13.182 +    case 27:           /* Esc will quit */
  13.183          exit(1);
  13.184 -        break;
  13.185 -    case 's':                  /* "s" start animation */
  13.186 +    break;
  13.187 +    case 's':             		/* "s" start animation */
  13.188          moving = GL_TRUE;
  13.189          //glutIdleFunc(Animate);
  13.190 -        break;
  13.191 -    case 'a':                  /* "a" stop animation */
  13.192 +    break;
  13.193 +    case 'a':          			/* "a" stop animation */
  13.194          moving = GL_FALSE;
  13.195          //glutIdleFunc(NULL);
  13.196 -        break;
  13.197 -    case '.':                  /* "." will advance frame */
  13.198 +    break;
  13.199 +    case '.':          			/* "." will advance frame */
  13.200          if (!moving) {
  13.201              Atlantis_Animate();
  13.202          }
  13.203      }
  13.204  }
  13.205 -
  13.206  /*
  13.207  void Display(void)
  13.208  {
  13.209 @@ -277,10 +273,10 @@
  13.210  Atlantis_Display(void)
  13.211  {
  13.212      int i;
  13.213 -    static double th[4] = { 0.0, 0.0, 0.0, 0.0 };
  13.214 -    static double t1 = 0.0, t2 = 0.0, t;
  13.215 -    char num_str[128];
  13.216 -
  13.217 +    static double th[4] = {0.0, 0.0, 0.0, 0.0};
  13.218 +	static double t1 = 0.0, t2 = 0.0, t;
  13.219 +	char num_str[128];
  13.220 +    
  13.221      t1 = t2;
  13.222  
  13.223      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  13.224 @@ -307,59 +303,56 @@
  13.225      glScalef(0.45, 0.45, 0.3);
  13.226      DrawWhale(&babyWhale);
  13.227      glPopMatrix();
  13.228 -
  13.229 -    if (Timing) {
  13.230 -        t2 = mtime();
  13.231 -        t = t2 - t1;
  13.232 -        if (t > 0.0001)
  13.233 -            t = 1.0 / t;
  13.234 -
  13.235 -        glDisable(GL_LIGHTING);
  13.236 -        //glDisable(GL_DEPTH_TEST);
  13.237 -
  13.238 -        glColor3f(1.0, 0.0, 0.0);
  13.239 -
  13.240 -        glMatrixMode(GL_PROJECTION);
  13.241 -        glPushMatrix();
  13.242 -        glLoadIdentity();
  13.243 -        glOrtho(0, w_win, 0, h_win, -10.0, 10.0);
  13.244 -
  13.245 -        glRasterPos2f(5.0, 5.0);
  13.246 -
  13.247 -        switch (StrMode) {
  13.248 -        case GL_VENDOR:
  13.249 -            sprintf(num_str, "%0.2f Hz, %dx%d, VENDOR: ", filter(t, th),
  13.250 -                    w_win, h_win);
  13.251 -            DrawStr(num_str);
  13.252 -            DrawStr(glGetString(GL_VENDOR));
  13.253 -            break;
  13.254 -        case GL_RENDERER:
  13.255 -            sprintf(num_str, "%0.2f Hz, %dx%d, RENDERER: ", filter(t, th),
  13.256 -                    w_win, h_win);
  13.257 -            DrawStr(num_str);
  13.258 -            DrawStr(glGetString(GL_RENDERER));
  13.259 -            break;
  13.260 -        case GL_VERSION:
  13.261 -            sprintf(num_str, "%0.2f Hz, %dx%d, VERSION: ", filter(t, th),
  13.262 -                    w_win, h_win);
  13.263 -            DrawStr(num_str);
  13.264 -            DrawStr(glGetString(GL_VERSION));
  13.265 -            break;
  13.266 -        case GL_EXTENSIONS:
  13.267 -            sprintf(num_str, "%0.2f Hz, %dx%d, EXTENSIONS: ", filter(t, th),
  13.268 -                    w_win, h_win);
  13.269 -            DrawStr(num_str);
  13.270 -            DrawStr(glGetString(GL_EXTENSIONS));
  13.271 -            break;
  13.272 -        }
  13.273 -
  13.274 -        glPopMatrix();
  13.275 -        glMatrixMode(GL_MODELVIEW);
  13.276 -
  13.277 -        glEnable(GL_LIGHTING);
  13.278 -        //glEnable(GL_DEPTH_TEST);
  13.279 -    }
  13.280 -
  13.281 +    
  13.282 +    if(Timing)
  13.283 +    {
  13.284 +		t2 = mtime();
  13.285 +		t = t2 - t1;
  13.286 +		if(t > 0.0001) t = 1.0 / t;
  13.287 +		
  13.288 +		glDisable(GL_LIGHTING);
  13.289 +		//glDisable(GL_DEPTH_TEST);
  13.290 +		
  13.291 +		glColor3f(1.0, 0.0, 0.0);
  13.292 +		
  13.293 +		glMatrixMode (GL_PROJECTION);
  13.294 +		glPushMatrix();
  13.295 +		glLoadIdentity();
  13.296 +		glOrtho(0, w_win, 0, h_win, -10.0, 10.0);
  13.297 +		
  13.298 +		glRasterPos2f(5.0, 5.0);
  13.299 +		
  13.300 +		switch(StrMode)
  13.301 +		{
  13.302 +			case GL_VENDOR:
  13.303 +				sprintf(num_str, "%0.2f Hz, %dx%d, VENDOR: ", filter(t, th), w_win, h_win);
  13.304 +				DrawStr(num_str);
  13.305 +				DrawStr(glGetString(GL_VENDOR));
  13.306 +			break;
  13.307 +			case GL_RENDERER:
  13.308 +				sprintf(num_str, "%0.2f Hz, %dx%d, RENDERER: ", filter(t, th), w_win, h_win);
  13.309 +				DrawStr(num_str);
  13.310 +				DrawStr(glGetString(GL_RENDERER));
  13.311 +			break;
  13.312 +			case GL_VERSION:
  13.313 +				sprintf(num_str, "%0.2f Hz, %dx%d, VERSION: ", filter(t, th), w_win, h_win);
  13.314 +				DrawStr(num_str);
  13.315 +				DrawStr(glGetString(GL_VERSION));
  13.316 +			break;
  13.317 +			case GL_EXTENSIONS:
  13.318 +				sprintf(num_str, "%0.2f Hz, %dx%d, EXTENSIONS: ", filter(t, th), w_win, h_win);
  13.319 +				DrawStr(num_str);
  13.320 +				DrawStr(glGetString(GL_EXTENSIONS));
  13.321 +			break;
  13.322 +		}
  13.323 +		
  13.324 +		glPopMatrix();
  13.325 +		glMatrixMode(GL_MODELVIEW);
  13.326 +		
  13.327 +		glEnable(GL_LIGHTING);
  13.328 +		//glEnable(GL_DEPTH_TEST);
  13.329 +	}
  13.330 +	
  13.331      count++;
  13.332  
  13.333      glutSwapBuffers();
  13.334 @@ -463,4 +456,4 @@
  13.335      glutMainLoop();
  13.336      return 0;             // ANSI C requires main to return int.
  13.337  }
  13.338 -*/
  13.339 +*/
  13.340 \ No newline at end of file
    14.1 --- a/Xcode/TemplatesForProjectBuilder/SDL OpenGL Application/atlantis/atlantis.h	Fri Aug 10 16:03:35 2007 +0000
    14.2 +++ b/Xcode/TemplatesForProjectBuilder/SDL OpenGL Application/atlantis/atlantis.h	Sat Aug 11 18:51:12 2007 +0000
    14.3 @@ -43,8 +43,7 @@
    14.4  
    14.5  #define WHALESPEED 250.0
    14.6  
    14.7 -typedef struct _fishRec
    14.8 -{
    14.9 +typedef struct _fishRec {
   14.10      float x, y, z, phi, theta, psi, v;
   14.11      float xt, yt, zt;
   14.12      float htail, vtail;
    15.1 --- a/Xcode/TemplatesForProjectBuilder/SDL OpenGL Application/atlantis/swim.c	Fri Aug 10 16:03:35 2007 +0000
    15.2 +++ b/Xcode/TemplatesForProjectBuilder/SDL OpenGL Application/atlantis/swim.c	Sat Aug 11 18:51:12 2007 +0000
    15.3 @@ -35,7 +35,7 @@
    15.4   * OpenGL(TM) is a trademark of Silicon Graphics, Inc.
    15.5   */
    15.6  #include <math.h>
    15.7 -#include <stdlib.h>             /* For rand(). */
    15.8 +#include <stdlib.h>  /* For rand(). */
    15.9  #include <GLUT/glut.h>
   15.10  #include "atlantis.h"
   15.11  
   15.12 @@ -57,10 +57,8 @@
   15.13      fish->theta = 0.0;
   15.14      fish->psi -= 0.5;
   15.15  
   15.16 -    fish->x +=
   15.17 -        WHALESPEED * fish->v * cos(fish->psi / RAD) * cos(fish->theta / RAD);
   15.18 -    fish->y +=
   15.19 -        WHALESPEED * fish->v * sin(fish->psi / RAD) * cos(fish->theta / RAD);
   15.20 +    fish->x += WHALESPEED * fish->v * cos(fish->psi / RAD) * cos(fish->theta / RAD);
   15.21 +    fish->y += WHALESPEED * fish->v * sin(fish->psi / RAD) * cos(fish->theta / RAD);
   15.22      fish->z += WHALESPEED * fish->v * sin(fish->theta / RAD);
   15.23  }
   15.24  
   15.25 @@ -154,10 +152,8 @@
   15.26          }
   15.27      }
   15.28  
   15.29 -    fish->x +=
   15.30 -        SHARKSPEED * fish->v * cos(fish->psi / RAD) * cos(fish->theta / RAD);
   15.31 -    fish->y +=
   15.32 -        SHARKSPEED * fish->v * sin(fish->psi / RAD) * cos(fish->theta / RAD);
   15.33 +    fish->x += SHARKSPEED * fish->v * cos(fish->psi / RAD) * cos(fish->theta / RAD);
   15.34 +    fish->y += SHARKSPEED * fish->v * sin(fish->psi / RAD) * cos(fish->theta / RAD);
   15.35      fish->z += SHARKSPEED * fish->v * sin(fish->theta / RAD);
   15.36  }
   15.37  
    16.1 --- a/Xcode/TemplatesForProjectBuilder/SDL OpenGL Application/main.c	Fri Aug 10 16:03:35 2007 +0000
    16.2 +++ b/Xcode/TemplatesForProjectBuilder/SDL OpenGL Application/main.c	Sat Aug 11 18:51:12 2007 +0000
    16.3 @@ -4,7 +4,7 @@
    16.4     Please see the SDL documentation for details on using the SDL API:
    16.5     /Developer/Documentation/SDL/docs.html
    16.6  */
    16.7 -
    16.8 +   
    16.9  #include <stdio.h>
   16.10  #include <stdlib.h>
   16.11  #include <string.h>
   16.12 @@ -12,175 +12,168 @@
   16.13  
   16.14  #include "SDL.h"
   16.15  
   16.16 -extern void Atlantis_Init();
   16.17 -extern void Atlantis_Reshape(int w, int h);
   16.18 -extern void Atlantis_Animate();
   16.19 -extern void Atlantis_Display();
   16.20 +extern void Atlantis_Init ();
   16.21 +extern void Atlantis_Reshape (int w, int h);
   16.22 +extern void Atlantis_Animate ();
   16.23 +extern void Atlantis_Display ();
   16.24  
   16.25  static SDL_Surface *gScreen;
   16.26  
   16.27 -static void
   16.28 -initAttributes()
   16.29 +static void initAttributes ()
   16.30  {
   16.31      // Setup attributes we want for the OpenGL context
   16.32 -
   16.33 +    
   16.34      int value;
   16.35 -
   16.36 +    
   16.37      // Don't set color bit sizes (SDL_GL_RED_SIZE, etc)
   16.38      //    Mac OS X will always use 8-8-8-8 ARGB for 32-bit screens and
   16.39      //    5-5-5 RGB for 16-bit screens
   16.40 -
   16.41 +    
   16.42      // Request a 16-bit depth buffer (without this, there is no depth buffer)
   16.43      value = 16;
   16.44 -    SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, value);
   16.45 -
   16.46 -
   16.47 +    SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, value);
   16.48 +    
   16.49 +    
   16.50      // Request double-buffered OpenGL
   16.51      //     The fact that windows are double-buffered on Mac OS X has no effect
   16.52      //     on OpenGL double buffering.
   16.53      value = 1;
   16.54 -    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, value);
   16.55 +    SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, value);
   16.56  }
   16.57  
   16.58 -static void
   16.59 -printAttributes()
   16.60 +static void printAttributes ()
   16.61  {
   16.62      // Print out attributes of the context we created
   16.63      int nAttr;
   16.64      int i;
   16.65 -
   16.66 -    int attr[] = { SDL_GL_RED_SIZE, SDL_GL_BLUE_SIZE, SDL_GL_GREEN_SIZE,
   16.67 -        SDL_GL_ALPHA_SIZE, SDL_GL_BUFFER_SIZE, SDL_GL_DEPTH_SIZE
   16.68 -    };
   16.69 -
   16.70 -    char *desc[] = { "Red size: %d bits\n", "Blue size: %d bits\n",
   16.71 -        "Green size: %d bits\n",
   16.72 -        "Alpha size: %d bits\n", "Color buffer size: %d bits\n",
   16.73 -        "Depth bufer size: %d bits\n"
   16.74 -    };
   16.75 +    
   16.76 +    int  attr[] = { SDL_GL_RED_SIZE, SDL_GL_BLUE_SIZE, SDL_GL_GREEN_SIZE,
   16.77 +                    SDL_GL_ALPHA_SIZE, SDL_GL_BUFFER_SIZE, SDL_GL_DEPTH_SIZE };
   16.78 +                    
   16.79 +    char *desc[] = { "Red size: %d bits\n", "Blue size: %d bits\n", "Green size: %d bits\n",
   16.80 +                     "Alpha size: %d bits\n", "Color buffer size: %d bits\n", 
   16.81 +                     "Depth bufer size: %d bits\n" };
   16.82  
   16.83      nAttr = sizeof(attr) / sizeof(int);
   16.84 -
   16.85 +    
   16.86      for (i = 0; i < nAttr; i++) {
   16.87 -
   16.88 +    
   16.89          int value;
   16.90 -        SDL_GL_GetAttribute(attr[i], &value);
   16.91 -        printf(desc[i], value);
   16.92 -    }
   16.93 +        SDL_GL_GetAttribute (attr[i], &value);
   16.94 +        printf (desc[i], value);
   16.95 +    } 
   16.96  }
   16.97  
   16.98 -static void
   16.99 -createSurface(int fullscreen)
  16.100 +static void createSurface (int fullscreen)
  16.101  {
  16.102      Uint32 flags = 0;
  16.103 -
  16.104 +    
  16.105      flags = SDL_OPENGL;
  16.106      if (fullscreen)
  16.107          flags |= SDL_FULLSCREEN;
  16.108 -
  16.109 +    
  16.110      // Create window
  16.111 -    gScreen = SDL_SetVideoMode(640, 480, 0, flags);
  16.112 +    gScreen = SDL_SetVideoMode (640, 480, 0, flags);
  16.113      if (gScreen == NULL) {
  16.114 -
  16.115 -        fprintf(stderr, "Couldn't set 640x480 OpenGL video mode: %s\n",
  16.116 -                SDL_GetError());
  16.117 -        SDL_Quit();
  16.118 -        exit(2);
  16.119 -    }
  16.120 +		
  16.121 +        fprintf (stderr, "Couldn't set 640x480 OpenGL video mode: %s\n",
  16.122 +                 SDL_GetError());
  16.123 +		SDL_Quit();
  16.124 +		exit(2);
  16.125 +	}
  16.126  }
  16.127  
  16.128 -static void
  16.129 -initGL()
  16.130 +static void initGL ()
  16.131  {
  16.132 -    Atlantis_Init();
  16.133 -    Atlantis_Reshape(gScreen->w, gScreen->h);
  16.134 +    Atlantis_Init ();
  16.135 +    Atlantis_Reshape (gScreen->w, gScreen->h);
  16.136  }
  16.137  
  16.138 -static void
  16.139 -drawGL()
  16.140 +static void drawGL ()
  16.141  {
  16.142 -    Atlantis_Animate();
  16.143 -    Atlantis_Display();
  16.144 +    Atlantis_Animate ();
  16.145 +    Atlantis_Display ();
  16.146  }
  16.147  
  16.148 -static void
  16.149 -mainLoop()
  16.150 +static void mainLoop ()
  16.151  {
  16.152      SDL_Event event;
  16.153      int done = 0;
  16.154      int fps = 24;
  16.155 -    int delay = 1000 / fps;
  16.156 +	int delay = 1000/fps;
  16.157      int thenTicks = -1;
  16.158      int nowTicks;
  16.159 +    
  16.160 +    while ( !done ) {
  16.161  
  16.162 -    while (!done) {
  16.163 +		/* Check for events */
  16.164 +		while ( SDL_PollEvent (&event) ) {
  16.165 +			switch (event.type) {
  16.166  
  16.167 -        /* Check for events */
  16.168 -        while (SDL_PollEvent(&event)) {
  16.169 -            switch (event.type) {
  16.170 -
  16.171 -            case SDL_MOUSEMOTION:
  16.172 -                break;
  16.173 -            case SDL_MOUSEBUTTONDOWN:
  16.174 -                break;
  16.175 -            case SDL_KEYDOWN:
  16.176 -                /* Any keypress quits the app... */
  16.177 -            case SDL_QUIT:
  16.178 -                done = 1;
  16.179 -                break;
  16.180 -            default:
  16.181 -                break;
  16.182 -            }
  16.183 -        }
  16.184 -
  16.185 +				case SDL_MOUSEMOTION:
  16.186 +					break;
  16.187 +				case SDL_MOUSEBUTTONDOWN:
  16.188 +					break;
  16.189 +				case SDL_KEYDOWN:
  16.190 +					/* Any keypress quits the app... */
  16.191 +				case SDL_QUIT:
  16.192 +					done = 1;
  16.193 +					break;
  16.194 +				default:
  16.195 +					break;
  16.196 +			}
  16.197 +		}
  16.198 +    
  16.199          // Draw at 24 hz
  16.200          //     This approach is not normally recommended - it is better to
  16.201          //     use time-based animation and run as fast as possible
  16.202 -        drawGL();
  16.203 -        SDL_GL_SwapBuffers();
  16.204 +        drawGL ();
  16.205 +        SDL_GL_SwapBuffers ();
  16.206  
  16.207          // Time how long each draw-swap-delay cycle takes
  16.208          // and adjust delay to get closer to target framerate
  16.209          if (thenTicks > 0) {
  16.210 -            nowTicks = SDL_GetTicks();
  16.211 -            delay += (1000 / fps - (nowTicks - thenTicks));
  16.212 +            nowTicks = SDL_GetTicks ();
  16.213 +            delay += (1000/fps - (nowTicks-thenTicks));
  16.214              thenTicks = nowTicks;
  16.215              if (delay < 0)
  16.216 -                delay = 1000 / fps;
  16.217 -        } else {
  16.218 -            thenTicks = SDL_GetTicks();
  16.219 +                delay = 1000/fps;
  16.220 +        }
  16.221 +        else {
  16.222 +            thenTicks = SDL_GetTicks ();
  16.223          }
  16.224  
  16.225 -        SDL_Delay(delay);
  16.226 -    }
  16.227 +        SDL_Delay (delay);
  16.228 +	}
  16.229  }
  16.230  
  16.231 -int
  16.232 -main(int argc, char *argv[])
  16.233 +int main(int argc, char *argv[])
  16.234  {
  16.235 -    // Init SDL video subsystem
  16.236 -    if (SDL_Init(SDL_INIT_VIDEO) < 0) {
  16.237 +	// Init SDL video subsystem
  16.238 +	if ( SDL_Init (SDL_INIT_VIDEO) < 0 ) {
  16.239 +		
  16.240 +        fprintf(stderr, "Couldn't initialize SDL: %s\n",
  16.241 +			SDL_GetError());
  16.242 +		exit(1);
  16.243 +	}
  16.244  
  16.245 -        fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
  16.246 -        exit(1);
  16.247 -    }
  16.248      // Set GL context attributes
  16.249 -    initAttributes();
  16.250 -
  16.251 +    initAttributes ();
  16.252 +    
  16.253      // Create GL context
  16.254 -    createSurface(0);
  16.255 -
  16.256 +    createSurface (0);
  16.257 +    
  16.258      // Get GL context attributes
  16.259 -    printAttributes();
  16.260 -
  16.261 +    printAttributes ();
  16.262 +    
  16.263      // Init GL state
  16.264 -    initGL();
  16.265 -
  16.266 +    initGL ();
  16.267 +    
  16.268      // Draw, get events...
  16.269 -    mainLoop();
  16.270 -
  16.271 +    mainLoop ();
  16.272 +    
  16.273      // Cleanup
  16.274 -    SDL_Quit();
  16.275 -
  16.276 +	SDL_Quit();
  16.277 +	
  16.278      return 0;
  16.279  }
    17.1 --- a/Xcode/TemplatesForXcode/SDL Application/SDLMain.h	Fri Aug 10 16:03:35 2007 +0000
    17.2 +++ b/Xcode/TemplatesForXcode/SDL Application/SDLMain.h	Sat Aug 11 18:51:12 2007 +0000
    17.3 @@ -7,4 +7,5 @@
    17.4  
    17.5  #import <Cocoa/Cocoa.h>
    17.6  
    17.7 -@ interface SDLMain:NSObject @ end
    17.8 +@interface SDLMain : NSObject
    17.9 +@end
    18.1 --- a/Xcode/TemplatesForXcode/SDL Application/main.c	Fri Aug 10 16:03:35 2007 +0000
    18.2 +++ b/Xcode/TemplatesForXcode/SDL Application/main.c	Sat Aug 11 18:51:12 2007 +0000
    18.3 @@ -4,7 +4,7 @@
    18.4     Please see the SDL documentation for details on using the SDL API:
    18.5     /Developer/Documentation/SDL/docs.html
    18.6  */
    18.7 -
    18.8 +   
    18.9  #include <stdio.h>
   18.10  #include <stdlib.h>
   18.11  #include <string.h>
   18.12 @@ -12,54 +12,54 @@
   18.13  
   18.14  #include "SDL.h"
   18.15  
   18.16 -int
   18.17 -main(int argc, char *argv[])
   18.18 +int main(int argc, char *argv[])
   18.19  {
   18.20 -    Uint32 initflags = SDL_INIT_VIDEO;  /* See documentation for details */
   18.21 -    SDL_Surface *screen;
   18.22 -    Uint8 video_bpp = 0;
   18.23 -    Uint32 videoflags = SDL_SWSURFACE;
   18.24 -    int done;
   18.25 -    SDL_Event event;
   18.26 +	Uint32 initflags = SDL_INIT_VIDEO;  /* See documentation for details */
   18.27 +	SDL_Surface *screen;
   18.28 +	Uint8  video_bpp = 0;
   18.29 +	Uint32 videoflags = SDL_SWSURFACE;
   18.30 +	int    done;
   18.31 +        SDL_Event event;
   18.32  
   18.33 -    /* Initialize the SDL library */
   18.34 -    if (SDL_Init(initflags) < 0) {
   18.35 -        fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
   18.36 -        exit(1);
   18.37 -    }
   18.38 +	/* Initialize the SDL library */
   18.39 +	if ( SDL_Init(initflags) < 0 ) {
   18.40 +		fprintf(stderr, "Couldn't initialize SDL: %s\n",
   18.41 +			SDL_GetError());
   18.42 +		exit(1);
   18.43 +	}
   18.44  
   18.45 -    /* Set 640x480 video mode */
   18.46 -    screen = SDL_SetVideoMode(640, 480, video_bpp, videoflags);
   18.47 -    if (screen == NULL) {
   18.48 -        fprintf(stderr, "Couldn't set 640x480x%d video mode: %s\n",
   18.49 -                video_bpp, SDL_GetError());
   18.50 -        SDL_Quit();
   18.51 -        exit(2);
   18.52 -    }
   18.53 +	/* Set 640x480 video mode */
   18.54 +	screen=SDL_SetVideoMode(640,480, video_bpp, videoflags);
   18.55 +        if (screen == NULL) {
   18.56 +		fprintf(stderr, "Couldn't set 640x480x%d video mode: %s\n",
   18.57 +                        video_bpp, SDL_GetError());
   18.58 +		SDL_Quit();
   18.59 +		exit(2);
   18.60 +	}
   18.61  
   18.62 -    done = 0;
   18.63 -    while (!done) {
   18.64 +	done = 0;
   18.65 +	while ( !done ) {
   18.66  
   18.67 -        /* Check for events */
   18.68 -        while (SDL_PollEvent(&event)) {
   18.69 -            switch (event.type) {
   18.70 +		/* Check for events */
   18.71 +		while ( SDL_PollEvent(&event) ) {
   18.72 +			switch (event.type) {
   18.73  
   18.74 -            case SDL_MOUSEMOTION:
   18.75 -                break;
   18.76 -            case SDL_MOUSEBUTTONDOWN:
   18.77 -                break;
   18.78 -            case SDL_KEYDOWN:
   18.79 -                /* Any keypress quits the app... */
   18.80 -            case SDL_QUIT:
   18.81 -                done = 1;
   18.82 -                break;
   18.83 -            default:
   18.84 -                break;
   18.85 -            }
   18.86 -        }
   18.87 -    }
   18.88 -
   18.89 -    /* Clean up the SDL library */
   18.90 -    SDL_Quit();
   18.91 -    return (0);
   18.92 +				case SDL_MOUSEMOTION:
   18.93 +					break;
   18.94 +				case SDL_MOUSEBUTTONDOWN:
   18.95 +					break;
   18.96 +				case SDL_KEYDOWN:
   18.97 +					/* Any keypress quits the app... */
   18.98 +				case SDL_QUIT:
   18.99 +					done = 1;
  18.100 +					break;
  18.101 +				default:
  18.102 +					break;
  18.103 +			}
  18.104 +		}
  18.105 +	}
  18.106 +	
  18.107 +	/* Clean up the SDL library */
  18.108 +	SDL_Quit();
  18.109 +	return(0);
  18.110  }
    19.1 --- a/Xcode/TemplatesForXcode/SDL Cocoa Application/SDLMain.h	Fri Aug 10 16:03:35 2007 +0000
    19.2 +++ b/Xcode/TemplatesForXcode/SDL Cocoa Application/SDLMain.h	Sat Aug 11 18:51:12 2007 +0000
    19.3 @@ -7,10 +7,11 @@
    19.4  
    19.5  #import <Cocoa/Cocoa.h>
    19.6  
    19.7 -@ interface SDLMain: NSObject - (IBAction) prefsMenu:(id) sender;
    19.8 --(IBAction) newGame:(id) sender;
    19.9 --(IBAction) openGame:(id) sender;
   19.10 --(IBAction) saveGame:(id) sender;
   19.11 --(IBAction) saveGameAs:(id) sender;
   19.12 --(IBAction) help:(id) sender;
   19.13 +@interface SDLMain : NSObject
   19.14 +- (IBAction)prefsMenu:(id)sender;
   19.15 +- (IBAction)newGame:(id)sender;
   19.16 +- (IBAction)openGame:(id)sender;
   19.17 +- (IBAction)saveGame:(id)sender;
   19.18 +- (IBAction)saveGameAs:(id)sender;
   19.19 +- (IBAction)help:(id)sender;
   19.20  @end
    20.1 --- a/Xcode/TemplatesForXcode/SDL Cocoa Application/main.c	Fri Aug 10 16:03:35 2007 +0000
    20.2 +++ b/Xcode/TemplatesForXcode/SDL Cocoa Application/main.c	Sat Aug 11 18:51:12 2007 +0000
    20.3 @@ -4,7 +4,7 @@
    20.4     Please see the SDL documentation for details on using the SDL API:
    20.5     /Developer/Documentation/SDL/docs.html
    20.6  */
    20.7 -
    20.8 +   
    20.9  #include <stdio.h>
   20.10  #include <stdlib.h>
   20.11  #include <string.h>
   20.12 @@ -12,54 +12,54 @@
   20.13  
   20.14  #include "SDL.h"
   20.15  
   20.16 -int
   20.17 -main(int argc, char *argv[])
   20.18 +int main(int argc, char *argv[])
   20.19  {
   20.20 -    Uint32 initflags = SDL_INIT_VIDEO;  /* See documentation for details */
   20.21 -    SDL_Surface *screen;
   20.22 -    Uint8 video_bpp = 0;
   20.23 -    Uint32 videoflags = SDL_SWSURFACE;
   20.24 -    int done;
   20.25 -    SDL_Event event;
   20.26 +	Uint32 initflags = SDL_INIT_VIDEO;  /* See documentation for details */
   20.27 +	SDL_Surface *screen;
   20.28 +	Uint8  video_bpp = 0;
   20.29 +	Uint32 videoflags = SDL_SWSURFACE;
   20.30 +	int    done;
   20.31 +        SDL_Event event;
   20.32  
   20.33 -    /* Initialize the SDL library */
   20.34 -    if (SDL_Init(initflags) < 0) {
   20.35 -        fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
   20.36 -        exit(1);
   20.37 -    }
   20.38 +	/* Initialize the SDL library */
   20.39 +	if ( SDL_Init(initflags) < 0 ) {
   20.40 +		fprintf(stderr, "Couldn't initialize SDL: %s\n",
   20.41 +			SDL_GetError());
   20.42 +		exit(1);
   20.43 +	}
   20.44  
   20.45 -    /* Set 640x480 video mode */
   20.46 -    screen = SDL_SetVideoMode(640, 480, video_bpp, videoflags);
   20.47 -    if (screen == NULL) {
   20.48 -        fprintf(stderr, "Couldn't set 640x480x%d video mode: %s\n",
   20.49 -                video_bpp, SDL_GetError());
   20.50 -        SDL_Quit();
   20.51 -        exit(2);
   20.52 -    }
   20.53 +	/* Set 640x480 video mode */
   20.54 +	screen=SDL_SetVideoMode(640,480, video_bpp, videoflags);
   20.55 +        if (screen == NULL) {
   20.56 +		fprintf(stderr, "Couldn't set 640x480x%d video mode: %s\n",
   20.57 +                        video_bpp, SDL_GetError());
   20.58 +		SDL_Quit();
   20.59 +		exit(2);
   20.60 +	}
   20.61  
   20.62 -    done = 0;
   20.63 -    while (!done) {
   20.64 +	done = 0;
   20.65 +	while ( !done ) {
   20.66  
   20.67 -        /* Check for events */
   20.68 -        while (SDL_PollEvent(&event)) {
   20.69 -            switch (event.type) {
   20.70 +		/* Check for events */
   20.71 +		while ( SDL_PollEvent(&event) ) {
   20.72 +			switch (event.type) {
   20.73  
   20.74 -            case SDL_MOUSEMOTION:
   20.75 -                break;
   20.76 -            case SDL_MOUSEBUTTONDOWN:
   20.77 -                break;
   20.78 -            case SDL_KEYDOWN:
   20.79 -                /* Any keypress quits the app... */
   20.80 -            case SDL_QUIT:
   20.81 -                done = 1;
   20.82 -                break;
   20.83 -            default:
   20.84 -                break;
   20.85 -            }
   20.86 -        }
   20.87 -    }
   20.88 -
   20.89 -    /* Clean up the SDL library */
   20.90 -    SDL_Quit();
   20.91 -    return (0);
   20.92 +				case SDL_MOUSEMOTION:
   20.93 +					break;
   20.94 +				case SDL_MOUSEBUTTONDOWN:
   20.95 +					break;
   20.96 +				case SDL_KEYDOWN:
   20.97 +					/* Any keypress quits the app... */
   20.98 +				case SDL_QUIT:
   20.99 +					done = 1;
  20.100 +					break;
  20.101 +				default:
  20.102 +					break;
  20.103 +			}
  20.104 +		}
  20.105 +	}
  20.106 +	
  20.107 +	/* Clean up the SDL library */
  20.108 +	SDL_Quit();
  20.109 +	return(0);
  20.110  }
    21.1 --- a/Xcode/TemplatesForXcode/SDL Custom Cocoa Application/MyController.h	Fri Aug 10 16:03:35 2007 +0000
    21.2 +++ b/Xcode/TemplatesForXcode/SDL Custom Cocoa Application/MyController.h	Sat Aug 11 18:51:12 2007 +0000
    21.3 @@ -9,35 +9,38 @@
    21.4  #import <Cocoa/Cocoa.h>
    21.5  #import "SDL.h"
    21.6  
    21.7 -extern id gController;          // instance of this class from nib
    21.8 +extern id gController; // instance of this class from nib
    21.9  
   21.10  // Declare SDL_QuartzWindowDelegate (defined in SDL.framework)
   21.11 -@interface SDL_QuartzWindowDelegate: NSObject @ end @ interface MyController:NSObject
   21.12 +@interface SDL_QuartzWindowDelegate : NSObject
   21.13 +@end
   21.14 +
   21.15 +@interface MyController : NSObject
   21.16  {
   21.17      // Interface Builder Outlets
   21.18 -    IBOutlet id _framesPerSecond;
   21.19 -    IBOutlet id _numSprites;
   21.20 -    IBOutlet id _window;
   21.21 -    IBOutlet id _view;
   21.22 +    IBOutlet id 	_framesPerSecond;
   21.23 +    IBOutlet id 	_numSprites;
   21.24 +    IBOutlet id 	_window;
   21.25 +    IBOutlet id 	_view;
   21.26 +    
   21.27 +    // Private instance variables
   21.28 +    int          _nSprites;
   21.29 +    int          _max_speed;
   21.30 +    int          _doFlip;
   21.31 +    Uint8*       _mem;
   21.32 +    
   21.33 +    SDL_Surface* _screen;
   21.34 +    SDL_Surface* _sprite;
   21.35 +    SDL_Rect*    _sprite_rects;
   21.36 +    SDL_Rect*    _positions;
   21.37 +    SDL_Rect*    _velocities;
   21.38 +    int          _sprites_visible;
   21.39 +    Uint16       _sprite_w, _sprite_h;
   21.40 +    
   21.41 +    int 		 _mouse_x, _mouse_y;
   21.42 +}
   21.43 +// Interface Builder Actions
   21.44 +- (IBAction)changeNumberOfSprites:(id)sender;
   21.45 +- (IBAction)selectUpdateMode:(id)sender;
   21.46 +@end
   21.47  
   21.48 -    // Private instance variables
   21.49 -    int _nSprites;
   21.50 -    int _max_speed;
   21.51 -    int _doFlip;
   21.52 -    Uint8 *_mem;
   21.53 -
   21.54 -    SDL_Surface *_screen;
   21.55 -    SDL_Surface *_sprite;
   21.56 -    SDL_Rect *_sprite_rects;
   21.57 -    SDL_Rect *_positions;
   21.58 -    SDL_Rect *_velocities;
   21.59 -    int _sprites_visible;
   21.60 -    Uint16 _sprite_w, _sprite_h;
   21.61 -
   21.62 -    int _mouse_x, _mouse_y;
   21.63 -}
   21.64 -
   21.65 -// Interface Builder Actions
   21.66 --(IBAction) changeNumberOfSprites:(id) sender;
   21.67 --(IBAction) selectUpdateMode:(id) sender;
   21.68 -@end
    22.1 --- a/Xcode/TemplatesForXcode/SDL Custom Cocoa Application/MyCustomView.h	Fri Aug 10 16:03:35 2007 +0000
    22.2 +++ b/Xcode/TemplatesForXcode/SDL Custom Cocoa Application/MyCustomView.h	Sat Aug 11 18:51:12 2007 +0000
    22.3 @@ -9,7 +9,8 @@
    22.4  #import <AppKit/AppKit.h>
    22.5  
    22.6  
    22.7 -@ interface MyCustomView:NSQuickDrawView {
    22.8 +@interface MyCustomView : NSQuickDrawView
    22.9 +{
   22.10  }
   22.11  
   22.12  @end
    23.1 --- a/Xcode/TemplatesForXcode/SDL Custom Cocoa Application/MyCustomWindow.h	Fri Aug 10 16:03:35 2007 +0000
    23.2 +++ b/Xcode/TemplatesForXcode/SDL Custom Cocoa Application/MyCustomWindow.h	Sat Aug 11 18:51:12 2007 +0000
    23.3 @@ -11,11 +11,17 @@
    23.4  // Be a subclass of SDL_QuartzWindow so SDL will
    23.5  // handle the redraw problems when minimizing the window
    23.6  // This class is defined in SDL.framework
    23.7 -@ interface SDL_QuartzWindow:NSWindow @ end
    23.8 +@interface SDL_QuartzWindow : NSWindow
    23.9 +@end
   23.10 +
   23.11  // Also assign SDL_QuartzWindowDelegate to the window
   23.12  // to perform other tasks. You can subclass this delegate
   23.13  // if you want to add your own delegation methods
   23.14  // This class is defined in SDL.framework
   23.15 -@ interface SDL_QuartzWindowDelegate:NSObject @ end
   23.16 +@interface SDL_QuartzWindowDelegate : NSObject
   23.17 +@end
   23.18 +
   23.19  // Declare our custom class
   23.20 -@ interface MyCustomWindow:SDL_QuartzWindow @ end
   23.21 +@interface MyCustomWindow : SDL_QuartzWindow
   23.22 +@end
   23.23 +
    24.1 --- a/Xcode/TemplatesForXcode/SDL Custom Cocoa Application/SDLMain.h	Fri Aug 10 16:03:35 2007 +0000
    24.2 +++ b/Xcode/TemplatesForXcode/SDL Custom Cocoa Application/SDLMain.h	Sat Aug 11 18:51:12 2007 +0000
    24.3 @@ -7,8 +7,8 @@
    24.4  
    24.5  #import <Cocoa/Cocoa.h>
    24.6  
    24.7 -@ interface SDLMain:NSObject {
    24.8 +@interface SDLMain : NSObject
    24.9 +{
   24.10      IBOutlet id _controller;
   24.11  }
   24.12 -
   24.13  @end
    25.1 --- a/Xcode/TemplatesForXcode/SDL OpenGL Application/SDLMain.h	Fri Aug 10 16:03:35 2007 +0000
    25.2 +++ b/Xcode/TemplatesForXcode/SDL OpenGL Application/SDLMain.h	Sat Aug 11 18:51:12 2007 +0000
    25.3 @@ -7,4 +7,5 @@
    25.4  
    25.5  #import <Cocoa/Cocoa.h>
    25.6  
    25.7 -@ interface SDLMain:NSObject @ end
    25.8 +@interface SDLMain : NSObject
    25.9 +@end
    26.1 --- a/Xcode/TemplatesForXcode/SDL OpenGL Application/atlantis/atlantis.c	Fri Aug 10 16:03:35 2007 +0000
    26.2 +++ b/Xcode/TemplatesForXcode/SDL OpenGL Application/atlantis/atlantis.c	Sat Aug 11 18:51:12 2007 +0000
    26.3 @@ -54,49 +54,46 @@
    26.4  
    26.5  int w_win = 640;
    26.6  int h_win = 480;
    26.7 -GLint count = 0;
    26.8 +GLint count  = 0;
    26.9  GLenum StrMode = GL_VENDOR;
   26.10  
   26.11  GLboolean moving;
   26.12  
   26.13 -static double
   26.14 -mtime(void)
   26.15 +static double mtime(void)
   26.16  {
   26.17 -    struct timeval tk_time;
   26.18 -    struct timezone tz;
   26.19 -
   26.20 -    gettimeofday(&tk_time, &tz);
   26.21 -
   26.22 -    return 4294.967296 * tk_time.tv_sec + 0.000001 * tk_time.tv_usec;
   26.23 +   struct timeval tk_time;
   26.24 +   struct timezone tz;
   26.25 +   
   26.26 +   gettimeofday(&tk_time, &tz);
   26.27 +   
   26.28 +   return 4294.967296 * tk_time.tv_sec + 0.000001 * tk_time.tv_usec;
   26.29  }
   26.30  
   26.31 -static double
   26.32 -filter(double in, double *save)
   26.33 +static double filter(double in, double *save)
   26.34  {
   26.35 -    static double k1 = 0.9;
   26.36 -    static double k2 = 0.05;
   26.37 +	static double k1 = 0.9;
   26.38 +	static double k2 = 0.05;
   26.39  
   26.40 -    save[3] = in;
   26.41 -    save[1] = save[0] * k1 + k2 * (save[3] + save[2]);
   26.42 +	save[3] = in;
   26.43 +	save[1] = save[0]*k1 + k2*(save[3] + save[2]);
   26.44  
   26.45 -    save[0] = save[1];
   26.46 -    save[2] = save[3];
   26.47 +	save[0]=save[1];
   26.48 +	save[2]=save[3];
   26.49  
   26.50 -    return (save[1]);
   26.51 +	return(save[1]);
   26.52  }
   26.53  
   26.54 -void
   26.55 -DrawStr(const char *str)
   26.56 +void DrawStr(const char *str)
   26.57  {
   26.58 -    GLint i = 0;
   26.59 -
   26.60 -    if (!str)
   26.61 -        return;
   26.62 -
   26.63 -    while (str[i]) {
   26.64 -        glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, str[i]);
   26.65 -        i++;
   26.66 -    }
   26.67 +	GLint i = 0;
   26.68 +	
   26.69 +	if(!str) return;
   26.70 +        
   26.71 +	while(str[i])
   26.72 +	{
   26.73 +		glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, str[i]);
   26.74 +		i++;
   26.75 +	}
   26.76  }
   26.77  
   26.78  void
   26.79 @@ -137,18 +134,18 @@
   26.80  void
   26.81  Atlantis_Init(void)
   26.82  {
   26.83 -    static float ambient[] = { 0.2, 0.2, 0.2, 1.0 };
   26.84 -    static float diffuse[] = { 1.0, 1.0, 1.0, 1.0 };
   26.85 -    static float position[] = { 0.0, 1.0, 0.0, 0.0 };
   26.86 -    static float mat_shininess[] = { 90.0 };
   26.87 -    static float mat_specular[] = { 0.8, 0.8, 0.8, 1.0 };
   26.88 -    static float mat_diffuse[] = { 0.46, 0.66, 0.795, 1.0 };
   26.89 -    static float mat_ambient[] = { 0.3, 0.4, 0.5, 1.0 };
   26.90 -    static float lmodel_ambient[] = { 0.4, 0.4, 0.4, 1.0 };
   26.91 -    static float lmodel_localviewer[] = { 0.0 };
   26.92 +    static float ambient[] = {0.2, 0.2, 0.2, 1.0};
   26.93 +    static float diffuse[] = {1.0, 1.0, 1.0, 1.0};
   26.94 +    static float position[] = {0.0, 1.0, 0.0, 0.0};
   26.95 +    static float mat_shininess[] = {90.0};
   26.96 +    static float mat_specular[] = {0.8, 0.8, 0.8, 1.0};
   26.97 +    static float mat_diffuse[] = {0.46, 0.66, 0.795, 1.0};
   26.98 +    static float mat_ambient[] = {0.3, 0.4, 0.5, 1.0};
   26.99 +    static float lmodel_ambient[] = {0.4, 0.4, 0.4, 1.0};
  26.100 +    static float lmodel_localviewer[] = {0.0};
  26.101      //GLfloat map1[4] = {0.0, 0.0, 0.0, 0.0};
  26.102      //GLfloat map2[4] = {0.0, 0.0, 0.0, 0.0};
  26.103 -    static float fog_color[] = { 0.0, 0.5, 0.9, 1.0 };
  26.104 +    static float fog_color[] = {0.0, 0.5, 0.9, 1.0};
  26.105  
  26.106      glFrontFace(GL_CCW);
  26.107  
  26.108 @@ -171,9 +168,9 @@
  26.109      InitFishs();
  26.110  
  26.111      glEnable(GL_FOG);
  26.112 -    glFogi(GL_FOG_MODE, GL_EXP);
  26.113 -    glFogf(GL_FOG_DENSITY, 0.0000025);
  26.114 -    glFogfv(GL_FOG_COLOR, fog_color);
  26.115 +	glFogi(GL_FOG_MODE, GL_EXP);
  26.116 +	glFogf(GL_FOG_DENSITY, 0.0000025);
  26.117 +	glFogfv(GL_FOG_COLOR, fog_color);
  26.118  
  26.119      glClearColor(0.0, 0.5, 0.9, 1.0);
  26.120  }
  26.121 @@ -181,15 +178,14 @@
  26.122  void
  26.123  Atlantis_Reshape(int width, int height)
  26.124  {
  26.125 -    w_win = width;
  26.126 -    h_win = height;
  26.127 -
  26.128 +	w_win = width;
  26.129 +	h_win = height;
  26.130 +	
  26.131      glViewport(0, 0, width, height);
  26.132  
  26.133      glMatrixMode(GL_PROJECTION);
  26.134      glLoadIdentity();
  26.135 -    gluPerspective(60.0, (GLfloat) width / (GLfloat) height, 20000.0,
  26.136 -                   300000.0);
  26.137 +    gluPerspective(60.0, (GLfloat) width / (GLfloat) height, 20000.0, 300000.0);
  26.138      glMatrixMode(GL_MODELVIEW);
  26.139  }
  26.140  
  26.141 @@ -216,42 +212,42 @@
  26.142  {
  26.143      switch (key) {
  26.144      case 't':
  26.145 -        Timing = !Timing;
  26.146 -        break;
  26.147 +    	Timing = !Timing;
  26.148 +    break;
  26.149      case ' ':
  26.150 -        switch (StrMode) {
  26.151 -        case GL_EXTENSIONS:
  26.152 -            StrMode = GL_VENDOR;
  26.153 -            break;
  26.154 -        case GL_VENDOR:
  26.155 -            StrMode = GL_RENDERER;
  26.156 -            break;
  26.157 -        case GL_RENDERER:
  26.158 -            StrMode = GL_VERSION;
  26.159 -            break;
  26.160 -        case GL_VERSION:
  26.161 -            StrMode = GL_EXTENSIONS;
  26.162 -            break;
  26.163 -        }
  26.164 -        break;
  26.165 -    case 27:                   /* Esc will quit */
  26.166 +    	switch(StrMode)
  26.167 +    	{
  26.168 +		    case GL_EXTENSIONS:
  26.169 +    			StrMode = GL_VENDOR;
  26.170 +		    break;
  26.171 +		    case GL_VENDOR:
  26.172 +		    	StrMode = GL_RENDERER;
  26.173 +		    break;
  26.174 +		    case GL_RENDERER:
  26.175 +		    	StrMode = GL_VERSION;
  26.176 +		    break;
  26.177 +		    case GL_VERSION:
  26.178 +		    	StrMode = GL_EXTENSIONS;
  26.179 +		    break;
  26.180 +		}
  26.181 +	break;
  26.182 +    case 27:           /* Esc will quit */
  26.183          exit(1);
  26.184 -        break;
  26.185 -    case 's':                  /* "s" start animation */
  26.186 +    break;
  26.187 +    case 's':             		/* "s" start animation */
  26.188          moving = GL_TRUE;
  26.189          //glutIdleFunc(Animate);
  26.190 -        break;
  26.191 -    case 'a':                  /* "a" stop animation */
  26.192 +    break;
  26.193 +    case 'a':          			/* "a" stop animation */
  26.194          moving = GL_FALSE;
  26.195          //glutIdleFunc(NULL);
  26.196 -        break;
  26.197 -    case '.':                  /* "." will advance frame */
  26.198 +    break;
  26.199 +    case '.':          			/* "." will advance frame */
  26.200          if (!moving) {
  26.201              Atlantis_Animate();
  26.202          }
  26.203      }
  26.204  }
  26.205 -
  26.206  /*
  26.207  void Display(void)
  26.208  {
  26.209 @@ -277,10 +273,10 @@
  26.210  Atlantis_Display(void)
  26.211  {
  26.212      int i;
  26.213 -    static double th[4] = { 0.0, 0.0, 0.0, 0.0 };
  26.214 -    static double t1 = 0.0, t2 = 0.0, t;
  26.215 -    char num_str[128];
  26.216 -
  26.217 +    static double th[4] = {0.0, 0.0, 0.0, 0.0};
  26.218 +	static double t1 = 0.0, t2 = 0.0, t;
  26.219 +	char num_str[128];
  26.220 +    
  26.221      t1 = t2;
  26.222  
  26.223      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  26.224 @@ -307,59 +303,56 @@
  26.225      glScalef(0.45, 0.45, 0.3);
  26.226      DrawWhale(&babyWhale);
  26.227      glPopMatrix();
  26.228 -
  26.229 -    if (Timing) {
  26.230 -        t2 = mtime();
  26.231 -        t = t2 - t1;
  26.232 -        if (t > 0.0001)
  26.233 -            t = 1.0 / t;
  26.234 -
  26.235 -        glDisable(GL_LIGHTING);
  26.236 -        //glDisable(GL_DEPTH_TEST);
  26.237 -
  26.238 -        glColor3f(1.0, 0.0, 0.0);
  26.239 -
  26.240 -        glMatrixMode(GL_PROJECTION);
  26.241 -        glPushMatrix();
  26.242 -        glLoadIdentity();
  26.243 -        glOrtho(0, w_win, 0, h_win, -10.0, 10.0);
  26.244 -
  26.245 -        glRasterPos2f(5.0, 5.0);
  26.246 -
  26.247 -        switch (StrMode) {
  26.248 -        case GL_VENDOR:
  26.249 -            sprintf(num_str, "%0.2f Hz, %dx%d, VENDOR: ", filter(t, th),
  26.250 -                    w_win, h_win);
  26.251 -            DrawStr(num_str);
  26.252 -            DrawStr(glGetString(GL_VENDOR));
  26.253 -            break;
  26.254 -        case GL_RENDERER:
  26.255 -            sprintf(num_str, "%0.2f Hz, %dx%d, RENDERER: ", filter(t, th),
  26.256 -                    w_win, h_win);
  26.257 -            DrawStr(num_str);
  26.258 -            DrawStr(glGetString(GL_RENDERER));
  26.259 -            break;
  26.260 -        case GL_VERSION:
  26.261 -            sprintf(num_str, "%0.2f Hz, %dx%d, VERSION: ", filter(t, th),
  26.262 -                    w_win, h_win);
  26.263 -            DrawStr(num_str);
  26.264 -            DrawStr(glGetString(GL_VERSION));
  26.265 -            break;
  26.266 -        case GL_EXTENSIONS:
  26.267 -            sprintf(num_str, "%0.2f Hz, %dx%d, EXTENSIONS: ", filter(t, th),
  26.268 -                    w_win, h_win);
  26.269 -            DrawStr(num_str);
  26.270 -            DrawStr(glGetString(GL_EXTENSIONS));
  26.271 -            break;
  26.272 -        }
  26.273 -
  26.274 -        glPopMatrix();
  26.275 -        glMatrixMode(GL_MODELVIEW);
  26.276 -
  26.277 -        glEnable(GL_LIGHTING);
  26.278 -        //glEnable(GL_DEPTH_TEST);
  26.279 -    }
  26.280 -
  26.281 +    
  26.282 +    if(Timing)
  26.283 +    {
  26.284 +		t2 = mtime();
  26.285 +		t = t2 - t1;
  26.286 +		if(t > 0.0001) t = 1.0 / t;
  26.287 +		
  26.288 +		glDisable(GL_LIGHTING);
  26.289 +		//glDisable(GL_DEPTH_TEST);
  26.290 +		
  26.291 +		glColor3f(1.0, 0.0, 0.0);
  26.292 +		
  26.293 +		glMatrixMode (GL_PROJECTION);
  26.294 +		glPushMatrix();
  26.295 +		glLoadIdentity();
  26.296 +		glOrtho(0, w_win, 0, h_win, -10.0, 10.0);
  26.297 +		
  26.298 +		glRasterPos2f(5.0, 5.0);
  26.299 +		
  26.300 +		switch(StrMode)
  26.301 +		{
  26.302 +			case GL_VENDOR:
  26.303 +				sprintf(num_str, "%0.2f Hz, %dx%d, VENDOR: ", filter(t, th), w_win, h_win);
  26.304 +				DrawStr(num_str);
  26.305 +				DrawStr(glGetString(GL_VENDOR));
  26.306 +			break;
  26.307 +			case GL_RENDERER:
  26.308 +				sprintf(num_str, "%0.2f Hz, %dx%d, RENDERER: ", filter(t, th), w_win, h_win);
  26.309 +				DrawStr(num_str);
  26.310 +				DrawStr(glGetString(GL_RENDERER));
  26.311 +			break;
  26.312 +			case GL_VERSION:
  26.313 +				sprintf(num_str, "%0.2f Hz, %dx%d, VERSION: ", filter(t, th), w_win, h_win);
  26.314 +				DrawStr(num_str);
  26.315 +				DrawStr(glGetString(GL_VERSION));
  26.316 +			break;
  26.317 +			case GL_EXTENSIONS:
  26.318 +				sprintf(num_str, "%0.2f Hz, %dx%d, EXTENSIONS: ", filter(t, th), w_win, h_win);
  26.319 +				DrawStr(num_str);
  26.320 +				DrawStr(glGetString(GL_EXTENSIONS));
  26.321 +			break;
  26.322 +		}
  26.323 +		
  26.324 +		glPopMatrix();
  26.325 +		glMatrixMode(GL_MODELVIEW);
  26.326 +		
  26.327 +		glEnable(GL_LIGHTING);
  26.328 +		//glEnable(GL_DEPTH_TEST);
  26.329 +	}
  26.330 +	
  26.331      count++;
  26.332  
  26.333      glutSwapBuffers();
  26.334 @@ -463,4 +456,4 @@
  26.335      glutMainLoop();
  26.336      return 0;             // ANSI C requires main to return int.
  26.337  }
  26.338 -*/
  26.339 +*/
  26.340 \ No newline at end of file
    27.1 --- a/Xcode/TemplatesForXcode/SDL OpenGL Application/atlantis/atlantis.h	Fri Aug 10 16:03:35 2007 +0000
    27.2 +++ b/Xcode/TemplatesForXcode/SDL OpenGL Application/atlantis/atlantis.h	Sat Aug 11 18:51:12 2007 +0000
    27.3 @@ -43,8 +43,7 @@
    27.4  
    27.5  #define WHALESPEED 250.0
    27.6  
    27.7 -typedef struct _fishRec
    27.8 -{
    27.9 +typedef struct _fishRec {
   27.10      float x, y, z, phi, theta, psi, v;
   27.11      float xt, yt, zt;
   27.12      float htail, vtail;
    28.1 --- a/Xcode/TemplatesForXcode/SDL OpenGL Application/atlantis/swim.c	Fri Aug 10 16:03:35 2007 +0000
    28.2 +++ b/Xcode/TemplatesForXcode/SDL OpenGL Application/atlantis/swim.c	Sat Aug 11 18:51:12 2007 +0000
    28.3 @@ -35,7 +35,7 @@
    28.4   * OpenGL(TM) is a trademark of Silicon Graphics, Inc.
    28.5   */
    28.6  #include <math.h>
    28.7 -#include <stdlib.h>             /* For rand(). */
    28.8 +#include <stdlib.h>  /* For rand(). */
    28.9  #include <GLUT/glut.h>
   28.10  #include "atlantis.h"
   28.11  
   28.12 @@ -57,10 +57,8 @@
   28.13      fish->theta = 0.0;
   28.14      fish->psi -= 0.5;
   28.15  
   28.16 -    fish->x +=
   28.17 -        WHALESPEED * fish->v * cos(fish->psi / RAD) * cos(fish->theta / RAD);
   28.18 -    fish->y +=
   28.19 -        WHALESPEED * fish->v * sin(fish->psi / RAD) * cos(fish->theta / RAD);
   28.20 +    fish->x += WHALESPEED * fish->v * cos(fish->psi / RAD) * cos(fish->theta / RAD);
   28.21 +    fish->y += WHALESPEED * fish->v * sin(fish->psi / RAD) * cos(fish->theta / RAD);
   28.22      fish->z += WHALESPEED * fish->v * sin(fish->theta / RAD);
   28.23  }
   28.24  
   28.25 @@ -154,10 +152,8 @@
   28.26          }
   28.27      }
   28.28  
   28.29 -    fish->x +=
   28.30 -        SHARKSPEED * fish->v * cos(fish->psi / RAD) * cos(fish->theta / RAD);
   28.31 -    fish->y +=
   28.32 -        SHARKSPEED * fish->v * sin(fish->psi / RAD) * cos(fish->theta / RAD);
   28.33 +    fish->x += SHARKSPEED * fish->v * cos(fish->psi / RAD) * cos(fish->theta / RAD);
   28.34 +    fish->y += SHARKSPEED * fish->v * sin(fish->psi / RAD) * cos(fish->theta / RAD);
   28.35      fish->z += SHARKSPEED * fish->v * sin(fish->theta / RAD);
   28.36  }
   28.37  
    29.1 --- a/Xcode/TemplatesForXcode/SDL OpenGL Application/main.c	Fri Aug 10 16:03:35 2007 +0000
    29.2 +++ b/Xcode/TemplatesForXcode/SDL OpenGL Application/main.c	Sat Aug 11 18:51:12 2007 +0000
    29.3 @@ -4,7 +4,7 @@
    29.4     Please see the SDL documentation for details on using the SDL API:
    29.5     /Developer/Documentation/SDL/docs.html
    29.6  */
    29.7 -
    29.8 +   
    29.9  #include <stdio.h>
   29.10  #include <stdlib.h>
   29.11  #include <string.h>
   29.12 @@ -12,175 +12,168 @@
   29.13  
   29.14  #include "SDL.h"
   29.15  
   29.16 -extern void Atlantis_Init();
   29.17 -extern void Atlantis_Reshape(int w, int h);
   29.18 -extern void Atlantis_Animate();
   29.19 -extern void Atlantis_Display();
   29.20 +extern void Atlantis_Init ();
   29.21 +extern void Atlantis_Reshape (int w, int h);
   29.22 +extern void Atlantis_Animate ();
   29.23 +extern void Atlantis_Display ();
   29.24  
   29.25  static SDL_Surface *gScreen;
   29.26  
   29.27 -static void
   29.28 -initAttributes()
   29.29 +static void initAttributes ()
   29.30  {
   29.31      // Setup attributes we want for the OpenGL context
   29.32 -
   29.33 +    
   29.34      int value;
   29.35 -
   29.36 +    
   29.37      // Don't set color bit sizes (SDL_GL_RED_SIZE, etc)
   29.38      //    Mac OS X will always use 8-8-8-8 ARGB for 32-bit screens and
   29.39      //    5-5-5 RGB for 16-bit screens
   29.40 -
   29.41 +    
   29.42      // Request a 16-bit depth buffer (without this, there is no depth buffer)
   29.43      value = 16;
   29.44 -    SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, value);
   29.45 -
   29.46 -
   29.47 +    SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, value);
   29.48 +    
   29.49 +    
   29.50      // Request double-buffered OpenGL
   29.51      //     The fact that windows are double-buffered on Mac OS X has no effect
   29.52      //     on OpenGL double buffering.
   29.53      value = 1;
   29.54 -    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, value);
   29.55 +    SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, value);
   29.56  }
   29.57  
   29.58 -static void
   29.59 -printAttributes()
   29.60 +static void printAttributes ()
   29.61  {
   29.62      // Print out attributes of the context we created
   29.63      int nAttr;
   29.64      int i;
   29.65 -
   29.66 -    int attr[] = { SDL_GL_RED_SIZE, SDL_GL_BLUE_SIZE, SDL_GL_GREEN_SIZE,
   29.67 -        SDL_GL_ALPHA_SIZE, SDL_GL_BUFFER_SIZE, SDL_GL_DEPTH_SIZE
   29.68 -    };
   29.69 -
   29.70 -    char *desc[] = { "Red size: %d bits\n", "Blue size: %d bits\n",
   29.71 -        "Green size: %d bits\n",
   29.72 -        "Alpha size: %d bits\n", "Color buffer size: %d bits\n",
   29.73 -        "Depth bufer size: %d bits\n"
   29.74 -    };
   29.75 +    
   29.76 +    int  attr[] = { SDL_GL_RED_SIZE, SDL_GL_BLUE_SIZE, SDL_GL_GREEN_SIZE,
   29.77 +                    SDL_GL_ALPHA_SIZE, SDL_GL_BUFFER_SIZE, SDL_GL_DEPTH_SIZE };
   29.78 +                    
   29.79 +    char *desc[] = { "Red size: %d bits\n", "Blue size: %d bits\n", "Green size: %d bits\n",
   29.80 +                     "Alpha size: %d bits\n", "Color buffer size: %d bits\n", 
   29.81 +                     "Depth bufer size: %d bits\n" };
   29.82  
   29.83      nAttr = sizeof(attr) / sizeof(int);
   29.84 -
   29.85 +    
   29.86      for (i = 0; i < nAttr; i++) {
   29.87 -
   29.88 +    
   29.89          int value;
   29.90 -        SDL_GL_GetAttribute(attr[i], &value);
   29.91 -        printf(desc[i], value);
   29.92 -    }
   29.93 +        SDL_GL_GetAttribute (attr[i], &value);
   29.94 +        printf (desc[i], value);
   29.95 +    } 
   29.96  }
   29.97  
   29.98 -static void
   29.99 -createSurface(int fullscreen)
  29.100 +static void createSurface (int fullscreen)
  29.101  {
  29.102      Uint32 flags = 0;
  29.103 -
  29.104 +    
  29.105      flags = SDL_OPENGL;
  29.106      if (fullscreen)
  29.107          flags |= SDL_FULLSCREEN;
  29.108 -
  29.109 +    
  29.110      // Create window
  29.111 -    gScreen = SDL_SetVideoMode(640, 480, 0, flags);
  29.112 +    gScreen = SDL_SetVideoMode (640, 480, 0, flags);
  29.113      if (gScreen == NULL) {
  29.114 -
  29.115 -        fprintf(stderr, "Couldn't set 640x480 OpenGL video mode: %s\n",
  29.116 -                SDL_GetError());
  29.117 -        SDL_Quit();
  29.118 -        exit(2);
  29.119 -    }
  29.120 +		
  29.121 +        fprintf (stderr, "Couldn't set 640x480 OpenGL video mode: %s\n",
  29.122 +                 SDL_GetError());
  29.123 +		SDL_Quit();
  29.124 +		exit(2);
  29.125 +	}
  29.126  }
  29.127  
  29.128 -static void
  29.129 -initGL()
  29.130 +static void initGL ()
  29.131  {
  29.132 -    Atlantis_Init();
  29.133 -    Atlantis_Reshape(gScreen->w, gScreen->h);
  29.134 +    Atlantis_Init ();
  29.135 +    Atlantis_Reshape (gScreen->w, gScreen->h);
  29.136  }
  29.137  
  29.138 -static void
  29.139 -drawGL()
  29.140 +static void drawGL ()
  29.141  {
  29.142 -    Atlantis_Animate();
  29.143 -    Atlantis_Display();
  29.144 +    Atlantis_Animate ();
  29.145 +    Atlantis_Display ();
  29.146  }
  29.147  
  29.148 -static void
  29.149 -mainLoop()
  29.150 +static void mainLoop ()
  29.151  {
  29.152      SDL_Event event;
  29.153      int done = 0;
  29.154      int fps = 24;
  29.155 -    int delay = 1000 / fps;
  29.156 +	int delay = 1000/fps;
  29.157      int thenTicks = -1;
  29.158      int nowTicks;
  29.159 +    
  29.160 +    while ( !done ) {
  29.161  
  29.162 -    while (!done) {
  29.163 +		/* Check for events */
  29.164 +		while ( SDL_PollEvent (&event) ) {
  29.165 +			switch (event.type) {
  29.166  
  29.167 -        /* Check for events */
  29.168 -        while (SDL_PollEvent(&event)) {
  29.169 -            switch (event.type) {
  29.170 -
  29.171 -            case SDL_MOUSEMOTION:
  29.172 -                break;
  29.173 -            case SDL_MOUSEBUTTONDOWN:
  29.174 -                break;
  29.175 -            case SDL_KEYDOWN:
  29.176 -                /* Any keypress quits the app... */
  29.177 -            case SDL_QUIT:
  29.178 -                done = 1;
  29.179 -                break;
  29.180 -            default:
  29.181 -                break;
  29.182 -            }
  29.183 -        }
  29.184 -
  29.185 +				case SDL_MOUSEMOTION:
  29.186 +					break;
  29.187 +				case SDL_MOUSEBUTTONDOWN:
  29.188 +					break;
  29.189 +				case SDL_KEYDOWN:
  29.190 +					/* Any keypress quits the app... */
  29.191 +				case SDL_QUIT:
  29.192 +					done = 1;
  29.193 +					break;
  29.194 +				default:
  29.195 +					break;
  29.196 +			}
  29.197 +		}
  29.198 +    
  29.199          // Draw at 24 hz
  29.200          //     This approach is not normally recommended - it is better to
  29.201          //     use time-based animation and run as fast as possible
  29.202 -        drawGL();
  29.203 -        SDL_GL_SwapBuffers();
  29.204 +        drawGL ();
  29.205 +        SDL_GL_SwapBuffers ();
  29.206  
  29.207          // Time how long each draw-swap-delay cycle takes
  29.208          // and adjust delay to get closer to target framerate
  29.209          if (thenTicks > 0) {
  29.210 -            nowTicks = SDL_GetTicks();
  29.211 -            delay += (1000 / fps - (nowTicks - thenTicks));
  29.212 +            nowTicks = SDL_GetTicks ();
  29.213 +            delay += (1000/fps - (nowTicks-thenTicks));
  29.214              thenTicks = nowTicks;
  29.215              if (delay < 0)
  29.216 -                delay = 1000 / fps;
  29.217 -        } else {
  29.218 -            thenTicks = SDL_GetTicks();
  29.219 +                delay = 1000/fps;
  29.220 +        }
  29.221 +        else {
  29.222 +            thenTicks = SDL_GetTicks ();
  29.223          }
  29.224  
  29.225 -        SDL_Delay(delay);
  29.226 -    }
  29.227 +        SDL_Delay (delay);
  29.228 +	}
  29.229  }
  29.230  
  29.231 -int
  29.232 -main(int argc, char *argv[])
  29.233 +int main(int argc, char *argv[])
  29.234  {
  29.235 -    // Init SDL video subsystem
  29.236 -    if (SDL_Init(SDL_INIT_VIDEO) < 0) {
  29.237 +	// Init SDL video subsystem
  29.238 +	if ( SDL_Init (SDL_INIT_VIDEO) < 0 ) {
  29.239 +		
  29.240 +        fprintf(stderr, "Couldn't initialize SDL: %s\n",
  29.241 +			SDL_GetError());
  29.242 +		exit(1);
  29.243 +	}
  29.244  
  29.245 -        fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
  29.246 -        exit(1);
  29.247 -    }
  29.248      // Set GL context attributes
  29.249 -    initAttributes();
  29.250 -
  29.251 +    initAttributes ();
  29.252 +    
  29.253      // Create GL context
  29.254 -    createSurface(0);
  29.255 -
  29.256 +    createSurface (0);
  29.257 +    
  29.258      // Get GL context attributes
  29.259 -    printAttributes();
  29.260 -
  29.261 +    printAttributes ();
  29.262 +    
  29.263      // Init GL state
  29.264 -    initGL();
  29.265 -
  29.266 +    initGL ();
  29.267 +    
  29.268      // Draw, get events...
  29.269 -    mainLoop();
  29.270 -
  29.271 +    mainLoop ();
  29.272 +    
  29.273      // Cleanup
  29.274 -    SDL_Quit();
  29.275 -
  29.276 +	SDL_Quit();
  29.277 +	
  29.278      return 0;
  29.279  }