annotate SDL 1.3 Mac OpenGL Application.xctemplate/atlantis/atlantis.c @ 0:b0b91cadc484

Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between the two is SDLMain. Copy all templates to ~/Library/Developer/Xcode/Templates/SDL or /Library/Developer/Xcode/Templates/SDL Templates based off information documented here: http://blog.boreal-kiss.net/2011/03/11/a-minimal-project-template-for-xcode-4/
author Eric Wing <ewing . public |-at-| gmail . com>
date Sun, 02 Oct 2011 21:14:53 -0700
parents
children
rev   line source
0
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
1
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
2 /* Copyright (c) Mark J. Kilgard, 1994. */
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
3
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
4 /**
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
5 * (c) Copyright 1993, 1994, Silicon Graphics, Inc.
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
6 * ALL RIGHTS RESERVED
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
7 * Permission to use, copy, modify, and distribute this software for
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
8 * any purpose and without fee is hereby granted, provided that the above
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
9 * copyright notice appear in all copies and that both the copyright notice
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
10 * and this permission notice appear in supporting documentation, and that
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
11 * the name of Silicon Graphics, Inc. not be used in advertising
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
12 * or publicity pertaining to distribution of the software without specific,
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
13 * written prior permission.
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
14 *
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
15 * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
16 * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
17 * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
18 * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
19 * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
20 * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
21 * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
22 * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
23 * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
24 * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
25 * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
26 * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
27 *
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
28 * US Government Users Restricted Rights
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
29 * Use, duplication, or disclosure by the Government is subject to
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
30 * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
31 * (c)(1)(ii) of the Rights in Technical Data and Computer Software
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
32 * clause at DFARS 252.227-7013 and/or in similar or successor
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
33 * clauses in the FAR or the DOD or NASA FAR Supplement.
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
34 * Unpublished-- rights reserved under the copyright laws of the
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
35 * United States. Contractor/manufacturer is Silicon Graphics,
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
36 * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
37 *
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
38 * OpenGL(TM) is a trademark of Silicon Graphics, Inc.
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
39 */
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
40 #include <stdio.h>
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
41 #include <stdlib.h>
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
42 #include <string.h>
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
43 #include <math.h>
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
44 #include <sys/time.h>
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
45 #ifdef USE_GLUT
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
46 #include <GLUT/glut.h>
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
47 #endif
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
48 #include "SDL_opengl.h"
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
49 #include "atlantis.h"
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
50
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
51 fishRec sharks[NUM_SHARKS];
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
52 fishRec momWhale;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
53 fishRec babyWhale;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
54 fishRec dolph;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
55
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
56 GLboolean Timing = GL_TRUE;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
57
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
58 int w_win = 640;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
59 int h_win = 480;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
60 GLint count = 0;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
61 GLenum StrMode = GL_VENDOR;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
62
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
63 GLboolean moving;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
64
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
65 static double mtime(void)
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
66 {
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
67 struct timeval tk_time;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
68 struct timezone tz;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
69
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
70 gettimeofday(&tk_time, &tz);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
71
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
72 return 4294.967296 * tk_time.tv_sec + 0.000001 * tk_time.tv_usec;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
73 }
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
74
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
75 static double filter(double in, double *save)
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
76 {
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
77 static double k1 = 0.9;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
78 static double k2 = 0.05;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
79
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
80 save[3] = in;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
81 save[1] = save[0]*k1 + k2*(save[3] + save[2]);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
82
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
83 save[0]=save[1];
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
84 save[2]=save[3];
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
85
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
86 return(save[1]);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
87 }
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
88
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
89 void DrawStr(const char *str)
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
90 {
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
91 #ifdef USE_GLUT
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
92 GLint i = 0;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
93
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
94 if(!str) return;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
95
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
96 while(str[i])
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
97 {
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
98 glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, str[i]);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
99 i++;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
100 }
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
101 #endif
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
102 }
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
103
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
104 void
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
105 InitFishs(void)
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
106 {
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
107 int i;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
108
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
109 for (i = 0; i < NUM_SHARKS; i++) {
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
110 sharks[i].x = 70000.0 + rand() % 6000;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
111 sharks[i].y = rand() % 6000;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
112 sharks[i].z = rand() % 6000;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
113 sharks[i].psi = rand() % 360 - 180.0;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
114 sharks[i].v = 1.0;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
115 }
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
116
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
117 dolph.x = 30000.0;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
118 dolph.y = 0.0;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
119 dolph.z = 6000.0;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
120 dolph.psi = 90.0;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
121 dolph.theta = 0.0;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
122 dolph.v = 3.0;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
123
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
124 momWhale.x = 70000.0;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
125 momWhale.y = 0.0;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
126 momWhale.z = 0.0;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
127 momWhale.psi = 90.0;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
128 momWhale.theta = 0.0;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
129 momWhale.v = 3.0;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
130
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
131 babyWhale.x = 60000.0;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
132 babyWhale.y = -2000.0;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
133 babyWhale.z = -2000.0;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
134 babyWhale.psi = 90.0;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
135 babyWhale.theta = 0.0;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
136 babyWhale.v = 3.0;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
137 }
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
138
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
139 void
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
140 Atlantis_Init(void)
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
141 {
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
142 static float ambient[] = {0.2, 0.2, 0.2, 1.0};
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
143 static float diffuse[] = {1.0, 1.0, 1.0, 1.0};
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
144 static float position[] = {0.0, 1.0, 0.0, 0.0};
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
145 static float mat_shininess[] = {90.0};
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
146 static float mat_specular[] = {0.8, 0.8, 0.8, 1.0};
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
147 static float mat_diffuse[] = {0.46, 0.66, 0.795, 1.0};
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
148 static float mat_ambient[] = {0.3, 0.4, 0.5, 1.0};
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
149 static float lmodel_ambient[] = {0.4, 0.4, 0.4, 1.0};
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
150 static float lmodel_localviewer[] = {0.0};
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
151 //GLfloat map1[4] = {0.0, 0.0, 0.0, 0.0};
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
152 //GLfloat map2[4] = {0.0, 0.0, 0.0, 0.0};
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
153 static float fog_color[] = {0.0, 0.5, 0.9, 1.0};
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
154
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
155 glFrontFace(GL_CCW);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
156
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
157 glDepthFunc(GL_LESS);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
158 glEnable(GL_DEPTH_TEST);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
159
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
160 glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
161 glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
162 glLightfv(GL_LIGHT0, GL_POSITION, position);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
163 glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
164 glLightModelfv(GL_LIGHT_MODEL_LOCAL_VIEWER, lmodel_localviewer);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
165 glEnable(GL_LIGHTING);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
166 glEnable(GL_LIGHT0);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
167
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
168 glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, mat_shininess);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
169 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, mat_specular);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
170 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, mat_diffuse);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
171 glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, mat_ambient);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
172
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
173 InitFishs();
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
174
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
175 glEnable(GL_FOG);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
176 glFogi(GL_FOG_MODE, GL_EXP);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
177 glFogf(GL_FOG_DENSITY, 0.0000025);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
178 glFogfv(GL_FOG_COLOR, fog_color);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
179
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
180 glClearColor(0.0, 0.5, 0.9, 1.0);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
181 }
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
182
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
183 void
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
184 Atlantis_Reshape(int width, int height)
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
185 {
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
186 w_win = width;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
187 h_win = height;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
188
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
189 glViewport(0, 0, width, height);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
190
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
191 glMatrixMode(GL_PROJECTION);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
192 glLoadIdentity();
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
193 gluPerspective(60.0, (GLfloat) width / (GLfloat) height, 20000.0, 300000.0);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
194 glMatrixMode(GL_MODELVIEW);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
195 }
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
196
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
197 void
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
198 Atlantis_Animate(void)
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
199 {
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
200 int i;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
201
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
202 for (i = 0; i < NUM_SHARKS; i++) {
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
203 SharkPilot(&sharks[i]);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
204 SharkMiss(i);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
205 }
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
206 WhalePilot(&dolph);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
207 dolph.phi++;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
208 //glutPostRedisplay();
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
209 WhalePilot(&momWhale);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
210 momWhale.phi++;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
211 WhalePilot(&babyWhale);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
212 babyWhale.phi++;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
213 }
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
214
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
215 void
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
216 Atlantis_Key(unsigned char key, int x, int y)
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
217 {
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
218 switch (key) {
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
219 case 't':
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
220 Timing = !Timing;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
221 break;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
222 case ' ':
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
223 switch(StrMode)
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
224 {
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
225 case GL_EXTENSIONS:
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
226 StrMode = GL_VENDOR;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
227 break;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
228 case GL_VENDOR:
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
229 StrMode = GL_RENDERER;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
230 break;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
231 case GL_RENDERER:
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
232 StrMode = GL_VERSION;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
233 break;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
234 case GL_VERSION:
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
235 StrMode = GL_EXTENSIONS;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
236 break;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
237 }
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
238 break;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
239 case 27: /* Esc will quit */
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
240 exit(1);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
241 break;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
242 case 's': /* "s" start animation */
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
243 moving = GL_TRUE;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
244 //glutIdleFunc(Animate);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
245 break;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
246 case 'a': /* "a" stop animation */
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
247 moving = GL_FALSE;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
248 //glutIdleFunc(NULL);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
249 break;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
250 case '.': /* "." will advance frame */
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
251 if (!moving) {
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
252 Atlantis_Animate();
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
253 }
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
254 }
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
255 }
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
256 /*
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
257 void Display(void)
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
258 {
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
259 static float P123[3] = {-448.94, -203.14, 9499.60};
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
260 static float P124[3] = {-442.64, -185.20, 9528.07};
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
261 static float P125[3] = {-441.07, -148.05, 9528.07};
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
262 static float P126[3] = {-443.43, -128.84, 9499.60};
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
263 static float P127[3] = {-456.87, -146.78, 9466.67};
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
264 static float P128[3] = {-453.68, -183.93, 9466.67};
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
265
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
266 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
267
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
268 glPushMatrix();
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
269 FishTransform(&dolph);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
270 DrawDolphin(&dolph);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
271 glPopMatrix();
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
272
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
273 glutSwapBuffers();
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
274 }
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
275 */
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
276
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
277 void
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
278 Atlantis_Display(void)
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
279 {
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
280 int i;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
281 static double th[4] = {0.0, 0.0, 0.0, 0.0};
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
282 static double t1 = 0.0, t2 = 0.0, t;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
283 char num_str[128];
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
284
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
285 t1 = t2;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
286
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
287 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
288
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
289 for (i = 0; i < NUM_SHARKS; i++) {
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
290 glPushMatrix();
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
291 FishTransform(&sharks[i]);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
292 DrawShark(&sharks[i]);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
293 glPopMatrix();
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
294 }
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
295
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
296 glPushMatrix();
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
297 FishTransform(&dolph);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
298 DrawDolphin(&dolph);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
299 glPopMatrix();
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
300
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
301 glPushMatrix();
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
302 FishTransform(&momWhale);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
303 DrawWhale(&momWhale);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
304 glPopMatrix();
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
305
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
306 glPushMatrix();
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
307 FishTransform(&babyWhale);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
308 glScalef(0.45, 0.45, 0.3);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
309 DrawWhale(&babyWhale);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
310 glPopMatrix();
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
311
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
312 if(Timing)
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
313 {
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
314 t2 = mtime();
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
315 t = t2 - t1;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
316 if(t > 0.0001) t = 1.0 / t;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
317
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
318 glDisable(GL_LIGHTING);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
319 //glDisable(GL_DEPTH_TEST);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
320
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
321 glColor3f(1.0, 0.0, 0.0);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
322
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
323 glMatrixMode (GL_PROJECTION);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
324 glPushMatrix();
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
325 glLoadIdentity();
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
326 glOrtho(0, w_win, 0, h_win, -10.0, 10.0);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
327
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
328 glRasterPos2f(5.0, 5.0);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
329
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
330 switch(StrMode)
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
331 {
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
332 case GL_VENDOR:
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
333 sprintf(num_str, "%0.2f Hz, %dx%d, VENDOR: ", filter(t, th), w_win, h_win);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
334 DrawStr(num_str);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
335 DrawStr(glGetString(GL_VENDOR));
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
336 break;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
337 case GL_RENDERER:
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
338 sprintf(num_str, "%0.2f Hz, %dx%d, RENDERER: ", filter(t, th), w_win, h_win);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
339 DrawStr(num_str);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
340 DrawStr(glGetString(GL_RENDERER));
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
341 break;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
342 case GL_VERSION:
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
343 sprintf(num_str, "%0.2f Hz, %dx%d, VERSION: ", filter(t, th), w_win, h_win);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
344 DrawStr(num_str);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
345 DrawStr(glGetString(GL_VERSION));
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
346 break;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
347 case GL_EXTENSIONS:
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
348 sprintf(num_str, "%0.2f Hz, %dx%d, EXTENSIONS: ", filter(t, th), w_win, h_win);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
349 DrawStr(num_str);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
350 DrawStr(glGetString(GL_EXTENSIONS));
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
351 break;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
352 }
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
353
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
354 glPopMatrix();
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
355 glMatrixMode(GL_MODELVIEW);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
356
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
357 glEnable(GL_LIGHTING);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
358 //glEnable(GL_DEPTH_TEST);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
359 }
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
360
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
361 count++;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
362
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
363 // glutSwapBuffers();
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
364 }
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
365
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
366 /*
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
367 void
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
368 Visible(int state)
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
369 {
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
370 if (state == GLUT_VISIBLE) {
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
371 if (moving)
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
372 glutIdleFunc(Animate);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
373 } else {
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
374 if (moving)
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
375 glutIdleFunc(NULL);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
376 }
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
377 }
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
378
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
379
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
380 void
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
381 timingSelect(int value)
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
382 {
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
383 switch(value)
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
384 {
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
385 case 1:
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
386 StrMode = GL_VENDOR;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
387 break;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
388 case 2:
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
389 StrMode = GL_RENDERER;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
390 break;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
391 case 3:
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
392 StrMode = GL_VERSION;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
393 break;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
394 case 4:
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
395 StrMode = GL_EXTENSIONS;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
396 break;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
397 }
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
398 }
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
399
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
400 void
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
401 menuSelect(int value)
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
402 {
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
403 switch (value) {
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
404 case 1:
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
405 moving = GL_TRUE;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
406 glutIdleFunc(Animate);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
407 break;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
408 case 2:
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
409 moving = GL_FALSE;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
410 glutIdleFunc(NULL);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
411 break;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
412 case 4:
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
413 exit(0);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
414 break;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
415 }
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
416 }
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
417
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
418 int
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
419 main(int argc, char **argv)
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
420 {
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
421 GLboolean fullscreen = GL_FALSE;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
422 GLint time_menu;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
423
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
424 srand(0);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
425
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
426 glutInit(&argc, argv);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
427 if (argc > 1 && !strcmp(argv[1], "-w"))
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
428 fullscreen = GL_FALSE;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
429
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
430 //glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
431 glutInitDisplayString("rgba double depth=24");
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
432 if (fullscreen) {
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
433 glutGameModeString("1024x768:32");
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
434 glutEnterGameMode();
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
435 } else {
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
436 glutInitWindowSize(320, 240);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
437 glutCreateWindow("Atlantis Timing");
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
438 }
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
439 Init();
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
440 glutDisplayFunc(Display);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
441 glutReshapeFunc(Reshape);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
442 glutKeyboardFunc(Key);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
443 moving = GL_TRUE;
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
444 glutIdleFunc(Animate);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
445 glutVisibilityFunc(Visible);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
446
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
447 time_menu = glutCreateMenu(timingSelect);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
448 glutAddMenuEntry("GL_VENDOR", 1);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
449 glutAddMenuEntry("GL_RENDERER", 2);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
450 glutAddMenuEntry("GL_VERSION", 3);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
451 glutAddMenuEntry("GL_EXTENSIONS", 4);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
452
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
453 glutCreateMenu(menuSelect);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
454 glutAddMenuEntry("Start motion", 1);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
455 glutAddMenuEntry("Stop motion", 2);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
456 glutAddSubMenu("Timing Mode", time_menu);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
457 glutAddMenuEntry("Quit", 4);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
458
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
459 //glutAttachMenu(GLUT_RIGHT_BUTTON);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
460 glutAttachMenu(GLUT_RIGHT_BUTTON);
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
461 glutMainLoop();
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
462 return 0; // ANSI C requires main to return int.
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
463 }
b0b91cadc484 Initial Xcode 4 templates for SDL/Mac 1.2 and 1.3. The major difference between
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff changeset
464 */