Don't run indent on the Xcode templates
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402582
This commit is contained in:
parent
22170d41cd
commit
838787d358
29 changed files with 729 additions and 740 deletions
|
@ -177,7 +177,7 @@ indent:
|
|||
-name '*.h' -o \
|
||||
-name '*.c' -o \
|
||||
-name '*.cc' \) \
|
||||
-print | \
|
||||
-print | fgrep -v ./Xcode | \
|
||||
while read file; do \
|
||||
indent "$$file" -o "$$file.indent"; \
|
||||
if cmp "$$file" "$$file.indent" >/dev/null; then \
|
||||
|
|
|
@ -7,4 +7,5 @@
|
|||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@ interface SDLMain:NSObject @ end
|
||||
@interface SDLMain : NSObject
|
||||
@end
|
||||
|
|
|
@ -12,8 +12,7 @@
|
|||
|
||||
#include "SDL.h"
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Uint32 initflags = SDL_INIT_VIDEO; /* See documentation for details */
|
||||
SDL_Surface *screen;
|
||||
|
@ -24,7 +23,8 @@ main(int argc, char *argv[])
|
|||
|
||||
/* Initialize the SDL library */
|
||||
if ( SDL_Init(initflags) < 0 ) {
|
||||
fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||
fprintf(stderr, "Couldn't initialize SDL: %s\n",
|
||||
SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@ interface SDLMain: NSObject - (IBAction) prefsMenu:(id) sender;
|
||||
@interface SDLMain : NSObject
|
||||
- (IBAction)prefsMenu:(id)sender;
|
||||
- (IBAction)newGame:(id)sender;
|
||||
- (IBAction)openGame:(id)sender;
|
||||
- (IBAction)saveGame:(id)sender;
|
||||
|
|
|
@ -12,8 +12,7 @@
|
|||
|
||||
#include "SDL.h"
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Uint32 initflags = SDL_INIT_VIDEO; /* See documentation for details */
|
||||
SDL_Surface *screen;
|
||||
|
@ -24,7 +23,8 @@ main(int argc, char *argv[])
|
|||
|
||||
/* Initialize the SDL library */
|
||||
if ( SDL_Init(initflags) < 0 ) {
|
||||
fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||
fprintf(stderr, "Couldn't initialize SDL: %s\n",
|
||||
SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,10 @@
|
|||
extern id gController; // instance of this class from nib
|
||||
|
||||
// Declare SDL_QuartzWindowDelegate (defined in SDL.framework)
|
||||
@interface SDL_QuartzWindowDelegate: NSObject @ end @ interface MyController:NSObject
|
||||
@interface SDL_QuartzWindowDelegate : NSObject
|
||||
@end
|
||||
|
||||
@interface MyController : NSObject
|
||||
{
|
||||
// Interface Builder Outlets
|
||||
IBOutlet id _framesPerSecond;
|
||||
|
@ -36,8 +39,8 @@ extern id gController; // instance of this class from nib
|
|||
|
||||
int _mouse_x, _mouse_y;
|
||||
}
|
||||
|
||||
// Interface Builder Actions
|
||||
- (IBAction)changeNumberOfSprites:(id)sender;
|
||||
- (IBAction)selectUpdateMode:(id)sender;
|
||||
@end
|
||||
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
#import <AppKit/AppKit.h>
|
||||
|
||||
|
||||
@ interface MyCustomView:NSQuickDrawView {
|
||||
@interface MyCustomView : NSQuickDrawView
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -11,11 +11,17 @@
|
|||
// Be a subclass of SDL_QuartzWindow so SDL will
|
||||
// handle the redraw problems when minimizing the window
|
||||
// This class is defined in SDL.framework
|
||||
@ interface SDL_QuartzWindow:NSWindow @ end
|
||||
@interface SDL_QuartzWindow : NSWindow
|
||||
@end
|
||||
|
||||
// Also assign SDL_QuartzWindowDelegate to the window
|
||||
// to perform other tasks. You can subclass this delegate
|
||||
// if you want to add your own delegation methods
|
||||
// This class is defined in SDL.framework
|
||||
@ interface SDL_QuartzWindowDelegate:NSObject @ end
|
||||
@interface SDL_QuartzWindowDelegate : NSObject
|
||||
@end
|
||||
|
||||
// Declare our custom class
|
||||
@ interface MyCustomWindow:SDL_QuartzWindow @ end
|
||||
@interface MyCustomWindow : SDL_QuartzWindow
|
||||
@end
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@ interface SDLMain:NSObject {
|
||||
@interface SDLMain : NSObject
|
||||
{
|
||||
IBOutlet id _controller;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -9,3 +9,4 @@
|
|||
|
||||
#include <Foundation/Foundation.h>
|
||||
#include <Cocoa/Cocoa.h>
|
||||
|
||||
|
|
|
@ -7,4 +7,5 @@
|
|||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@ interface SDLMain:NSObject @ end
|
||||
@interface SDLMain : NSObject
|
||||
@end
|
||||
|
|
|
@ -59,8 +59,7 @@ GLenum StrMode = GL_VENDOR;
|
|||
|
||||
GLboolean moving;
|
||||
|
||||
static double
|
||||
mtime(void)
|
||||
static double mtime(void)
|
||||
{
|
||||
struct timeval tk_time;
|
||||
struct timezone tz;
|
||||
|
@ -70,8 +69,7 @@ mtime(void)
|
|||
return 4294.967296 * tk_time.tv_sec + 0.000001 * tk_time.tv_usec;
|
||||
}
|
||||
|
||||
static double
|
||||
filter(double in, double *save)
|
||||
static double filter(double in, double *save)
|
||||
{
|
||||
static double k1 = 0.9;
|
||||
static double k2 = 0.05;
|
||||
|
@ -85,15 +83,14 @@ filter(double in, double *save)
|
|||
return(save[1]);
|
||||
}
|
||||
|
||||
void
|
||||
DrawStr(const char *str)
|
||||
void DrawStr(const char *str)
|
||||
{
|
||||
GLint i = 0;
|
||||
|
||||
if (!str)
|
||||
return;
|
||||
if(!str) return;
|
||||
|
||||
while (str[i]) {
|
||||
while(str[i])
|
||||
{
|
||||
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, str[i]);
|
||||
i++;
|
||||
}
|
||||
|
@ -188,8 +185,7 @@ Atlantis_Reshape(int width, int height)
|
|||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
gluPerspective(60.0, (GLfloat) width / (GLfloat) height, 20000.0,
|
||||
300000.0);
|
||||
gluPerspective(60.0, (GLfloat) width / (GLfloat) height, 20000.0, 300000.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
|
@ -219,7 +215,8 @@ Atlantis_Key(unsigned char key, int x, int y)
|
|||
Timing = !Timing;
|
||||
break;
|
||||
case ' ':
|
||||
switch (StrMode) {
|
||||
switch(StrMode)
|
||||
{
|
||||
case GL_EXTENSIONS:
|
||||
StrMode = GL_VENDOR;
|
||||
break;
|
||||
|
@ -251,7 +248,6 @@ Atlantis_Key(unsigned char key, int x, int y)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void Display(void)
|
||||
{
|
||||
|
@ -308,11 +304,11 @@ Atlantis_Display(void)
|
|||
DrawWhale(&babyWhale);
|
||||
glPopMatrix();
|
||||
|
||||
if (Timing) {
|
||||
if(Timing)
|
||||
{
|
||||
t2 = mtime();
|
||||
t = t2 - t1;
|
||||
if (t > 0.0001)
|
||||
t = 1.0 / t;
|
||||
if(t > 0.0001) t = 1.0 / t;
|
||||
|
||||
glDisable(GL_LIGHTING);
|
||||
//glDisable(GL_DEPTH_TEST);
|
||||
|
@ -326,28 +322,25 @@ Atlantis_Display(void)
|
|||
|
||||
glRasterPos2f(5.0, 5.0);
|
||||
|
||||
switch (StrMode) {
|
||||
switch(StrMode)
|
||||
{
|
||||
case GL_VENDOR:
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, VENDOR: ", filter(t, th),
|
||||
w_win, h_win);
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, VENDOR: ", filter(t, th), w_win, h_win);
|
||||
DrawStr(num_str);
|
||||
DrawStr(glGetString(GL_VENDOR));
|
||||
break;
|
||||
case GL_RENDERER:
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, RENDERER: ", filter(t, th),
|
||||
w_win, h_win);
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, RENDERER: ", filter(t, th), w_win, h_win);
|
||||
DrawStr(num_str);
|
||||
DrawStr(glGetString(GL_RENDERER));
|
||||
break;
|
||||
case GL_VERSION:
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, VERSION: ", filter(t, th),
|
||||
w_win, h_win);
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, VERSION: ", filter(t, th), w_win, h_win);
|
||||
DrawStr(num_str);
|
||||
DrawStr(glGetString(GL_VERSION));
|
||||
break;
|
||||
case GL_EXTENSIONS:
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, EXTENSIONS: ", filter(t, th),
|
||||
w_win, h_win);
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, EXTENSIONS: ", filter(t, th), w_win, h_win);
|
||||
DrawStr(num_str);
|
||||
DrawStr(glGetString(GL_EXTENSIONS));
|
||||
break;
|
||||
|
|
|
@ -43,8 +43,7 @@
|
|||
|
||||
#define WHALESPEED 250.0
|
||||
|
||||
typedef struct _fishRec
|
||||
{
|
||||
typedef struct _fishRec {
|
||||
float x, y, z, phi, theta, psi, v;
|
||||
float xt, yt, zt;
|
||||
float htail, vtail;
|
||||
|
|
|
@ -57,10 +57,8 @@ WhalePilot(fishRec * fish)
|
|||
fish->theta = 0.0;
|
||||
fish->psi -= 0.5;
|
||||
|
||||
fish->x +=
|
||||
WHALESPEED * fish->v * cos(fish->psi / RAD) * cos(fish->theta / RAD);
|
||||
fish->y +=
|
||||
WHALESPEED * fish->v * sin(fish->psi / RAD) * cos(fish->theta / RAD);
|
||||
fish->x += WHALESPEED * fish->v * cos(fish->psi / RAD) * cos(fish->theta / RAD);
|
||||
fish->y += WHALESPEED * fish->v * sin(fish->psi / RAD) * cos(fish->theta / RAD);
|
||||
fish->z += WHALESPEED * fish->v * sin(fish->theta / RAD);
|
||||
}
|
||||
|
||||
|
@ -154,10 +152,8 @@ SharkPilot(fishRec * fish)
|
|||
}
|
||||
}
|
||||
|
||||
fish->x +=
|
||||
SHARKSPEED * fish->v * cos(fish->psi / RAD) * cos(fish->theta / RAD);
|
||||
fish->y +=
|
||||
SHARKSPEED * fish->v * sin(fish->psi / RAD) * cos(fish->theta / RAD);
|
||||
fish->x += SHARKSPEED * fish->v * cos(fish->psi / RAD) * cos(fish->theta / RAD);
|
||||
fish->y += SHARKSPEED * fish->v * sin(fish->psi / RAD) * cos(fish->theta / RAD);
|
||||
fish->z += SHARKSPEED * fish->v * sin(fish->theta / RAD);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,7 @@ extern void Atlantis_Display();
|
|||
|
||||
static SDL_Surface *gScreen;
|
||||
|
||||
static void
|
||||
initAttributes()
|
||||
static void initAttributes ()
|
||||
{
|
||||
// Setup attributes we want for the OpenGL context
|
||||
|
||||
|
@ -42,22 +41,18 @@ initAttributes()
|
|||
SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, value);
|
||||
}
|
||||
|
||||
static void
|
||||
printAttributes()
|
||||
static void printAttributes ()
|
||||
{
|
||||
// Print out attributes of the context we created
|
||||
int nAttr;
|
||||
int i;
|
||||
|
||||
int attr[] = { SDL_GL_RED_SIZE, SDL_GL_BLUE_SIZE, SDL_GL_GREEN_SIZE,
|
||||
SDL_GL_ALPHA_SIZE, SDL_GL_BUFFER_SIZE, SDL_GL_DEPTH_SIZE
|
||||
};
|
||||
SDL_GL_ALPHA_SIZE, SDL_GL_BUFFER_SIZE, SDL_GL_DEPTH_SIZE };
|
||||
|
||||
char *desc[] = { "Red size: %d bits\n", "Blue size: %d bits\n",
|
||||
"Green size: %d bits\n",
|
||||
char *desc[] = { "Red size: %d bits\n", "Blue size: %d bits\n", "Green size: %d bits\n",
|
||||
"Alpha size: %d bits\n", "Color buffer size: %d bits\n",
|
||||
"Depth bufer size: %d bits\n"
|
||||
};
|
||||
"Depth bufer size: %d bits\n" };
|
||||
|
||||
nAttr = sizeof(attr) / sizeof(int);
|
||||
|
||||
|
@ -69,8 +64,7 @@ printAttributes()
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
createSurface(int fullscreen)
|
||||
static void createSurface (int fullscreen)
|
||||
{
|
||||
Uint32 flags = 0;
|
||||
|
||||
|
@ -89,22 +83,19 @@ createSurface(int fullscreen)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
initGL()
|
||||
static void initGL ()
|
||||
{
|
||||
Atlantis_Init ();
|
||||
Atlantis_Reshape (gScreen->w, gScreen->h);
|
||||
}
|
||||
|
||||
static void
|
||||
drawGL()
|
||||
static void drawGL ()
|
||||
{
|
||||
Atlantis_Animate ();
|
||||
Atlantis_Display ();
|
||||
}
|
||||
|
||||
static void
|
||||
mainLoop()
|
||||
static void mainLoop ()
|
||||
{
|
||||
SDL_Event event;
|
||||
int done = 0;
|
||||
|
@ -147,7 +138,8 @@ mainLoop()
|
|||
thenTicks = nowTicks;
|
||||
if (delay < 0)
|
||||
delay = 1000/fps;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
thenTicks = SDL_GetTicks ();
|
||||
}
|
||||
|
||||
|
@ -155,15 +147,16 @@ mainLoop()
|
|||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// Init SDL video subsystem
|
||||
if ( SDL_Init (SDL_INIT_VIDEO) < 0 ) {
|
||||
|
||||
fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||
fprintf(stderr, "Couldn't initialize SDL: %s\n",
|
||||
SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Set GL context attributes
|
||||
initAttributes ();
|
||||
|
||||
|
|
|
@ -7,4 +7,5 @@
|
|||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@ interface SDLMain:NSObject @ end
|
||||
@interface SDLMain : NSObject
|
||||
@end
|
||||
|
|
|
@ -12,8 +12,7 @@
|
|||
|
||||
#include "SDL.h"
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Uint32 initflags = SDL_INIT_VIDEO; /* See documentation for details */
|
||||
SDL_Surface *screen;
|
||||
|
@ -24,7 +23,8 @@ main(int argc, char *argv[])
|
|||
|
||||
/* Initialize the SDL library */
|
||||
if ( SDL_Init(initflags) < 0 ) {
|
||||
fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||
fprintf(stderr, "Couldn't initialize SDL: %s\n",
|
||||
SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@ interface SDLMain: NSObject - (IBAction) prefsMenu:(id) sender;
|
||||
@interface SDLMain : NSObject
|
||||
- (IBAction)prefsMenu:(id)sender;
|
||||
- (IBAction)newGame:(id)sender;
|
||||
- (IBAction)openGame:(id)sender;
|
||||
- (IBAction)saveGame:(id)sender;
|
||||
|
|
|
@ -12,8 +12,7 @@
|
|||
|
||||
#include "SDL.h"
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Uint32 initflags = SDL_INIT_VIDEO; /* See documentation for details */
|
||||
SDL_Surface *screen;
|
||||
|
@ -24,7 +23,8 @@ main(int argc, char *argv[])
|
|||
|
||||
/* Initialize the SDL library */
|
||||
if ( SDL_Init(initflags) < 0 ) {
|
||||
fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||
fprintf(stderr, "Couldn't initialize SDL: %s\n",
|
||||
SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,10 @@
|
|||
extern id gController; // instance of this class from nib
|
||||
|
||||
// Declare SDL_QuartzWindowDelegate (defined in SDL.framework)
|
||||
@interface SDL_QuartzWindowDelegate: NSObject @ end @ interface MyController:NSObject
|
||||
@interface SDL_QuartzWindowDelegate : NSObject
|
||||
@end
|
||||
|
||||
@interface MyController : NSObject
|
||||
{
|
||||
// Interface Builder Outlets
|
||||
IBOutlet id _framesPerSecond;
|
||||
|
@ -36,8 +39,8 @@ extern id gController; // instance of this class from nib
|
|||
|
||||
int _mouse_x, _mouse_y;
|
||||
}
|
||||
|
||||
// Interface Builder Actions
|
||||
- (IBAction)changeNumberOfSprites:(id)sender;
|
||||
- (IBAction)selectUpdateMode:(id)sender;
|
||||
@end
|
||||
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
#import <AppKit/AppKit.h>
|
||||
|
||||
|
||||
@ interface MyCustomView:NSQuickDrawView {
|
||||
@interface MyCustomView : NSQuickDrawView
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -11,11 +11,17 @@
|
|||
// Be a subclass of SDL_QuartzWindow so SDL will
|
||||
// handle the redraw problems when minimizing the window
|
||||
// This class is defined in SDL.framework
|
||||
@ interface SDL_QuartzWindow:NSWindow @ end
|
||||
@interface SDL_QuartzWindow : NSWindow
|
||||
@end
|
||||
|
||||
// Also assign SDL_QuartzWindowDelegate to the window
|
||||
// to perform other tasks. You can subclass this delegate
|
||||
// if you want to add your own delegation methods
|
||||
// This class is defined in SDL.framework
|
||||
@ interface SDL_QuartzWindowDelegate:NSObject @ end
|
||||
@interface SDL_QuartzWindowDelegate : NSObject
|
||||
@end
|
||||
|
||||
// Declare our custom class
|
||||
@ interface MyCustomWindow:SDL_QuartzWindow @ end
|
||||
@interface MyCustomWindow : SDL_QuartzWindow
|
||||
@end
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@ interface SDLMain:NSObject {
|
||||
@interface SDLMain : NSObject
|
||||
{
|
||||
IBOutlet id _controller;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -7,4 +7,5 @@
|
|||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@ interface SDLMain:NSObject @ end
|
||||
@interface SDLMain : NSObject
|
||||
@end
|
||||
|
|
|
@ -59,8 +59,7 @@ GLenum StrMode = GL_VENDOR;
|
|||
|
||||
GLboolean moving;
|
||||
|
||||
static double
|
||||
mtime(void)
|
||||
static double mtime(void)
|
||||
{
|
||||
struct timeval tk_time;
|
||||
struct timezone tz;
|
||||
|
@ -70,8 +69,7 @@ mtime(void)
|
|||
return 4294.967296 * tk_time.tv_sec + 0.000001 * tk_time.tv_usec;
|
||||
}
|
||||
|
||||
static double
|
||||
filter(double in, double *save)
|
||||
static double filter(double in, double *save)
|
||||
{
|
||||
static double k1 = 0.9;
|
||||
static double k2 = 0.05;
|
||||
|
@ -85,15 +83,14 @@ filter(double in, double *save)
|
|||
return(save[1]);
|
||||
}
|
||||
|
||||
void
|
||||
DrawStr(const char *str)
|
||||
void DrawStr(const char *str)
|
||||
{
|
||||
GLint i = 0;
|
||||
|
||||
if (!str)
|
||||
return;
|
||||
if(!str) return;
|
||||
|
||||
while (str[i]) {
|
||||
while(str[i])
|
||||
{
|
||||
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, str[i]);
|
||||
i++;
|
||||
}
|
||||
|
@ -188,8 +185,7 @@ Atlantis_Reshape(int width, int height)
|
|||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
gluPerspective(60.0, (GLfloat) width / (GLfloat) height, 20000.0,
|
||||
300000.0);
|
||||
gluPerspective(60.0, (GLfloat) width / (GLfloat) height, 20000.0, 300000.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
|
@ -219,7 +215,8 @@ Atlantis_Key(unsigned char key, int x, int y)
|
|||
Timing = !Timing;
|
||||
break;
|
||||
case ' ':
|
||||
switch (StrMode) {
|
||||
switch(StrMode)
|
||||
{
|
||||
case GL_EXTENSIONS:
|
||||
StrMode = GL_VENDOR;
|
||||
break;
|
||||
|
@ -251,7 +248,6 @@ Atlantis_Key(unsigned char key, int x, int y)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void Display(void)
|
||||
{
|
||||
|
@ -308,11 +304,11 @@ Atlantis_Display(void)
|
|||
DrawWhale(&babyWhale);
|
||||
glPopMatrix();
|
||||
|
||||
if (Timing) {
|
||||
if(Timing)
|
||||
{
|
||||
t2 = mtime();
|
||||
t = t2 - t1;
|
||||
if (t > 0.0001)
|
||||
t = 1.0 / t;
|
||||
if(t > 0.0001) t = 1.0 / t;
|
||||
|
||||
glDisable(GL_LIGHTING);
|
||||
//glDisable(GL_DEPTH_TEST);
|
||||
|
@ -326,28 +322,25 @@ Atlantis_Display(void)
|
|||
|
||||
glRasterPos2f(5.0, 5.0);
|
||||
|
||||
switch (StrMode) {
|
||||
switch(StrMode)
|
||||
{
|
||||
case GL_VENDOR:
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, VENDOR: ", filter(t, th),
|
||||
w_win, h_win);
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, VENDOR: ", filter(t, th), w_win, h_win);
|
||||
DrawStr(num_str);
|
||||
DrawStr(glGetString(GL_VENDOR));
|
||||
break;
|
||||
case GL_RENDERER:
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, RENDERER: ", filter(t, th),
|
||||
w_win, h_win);
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, RENDERER: ", filter(t, th), w_win, h_win);
|
||||
DrawStr(num_str);
|
||||
DrawStr(glGetString(GL_RENDERER));
|
||||
break;
|
||||
case GL_VERSION:
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, VERSION: ", filter(t, th),
|
||||
w_win, h_win);
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, VERSION: ", filter(t, th), w_win, h_win);
|
||||
DrawStr(num_str);
|
||||
DrawStr(glGetString(GL_VERSION));
|
||||
break;
|
||||
case GL_EXTENSIONS:
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, EXTENSIONS: ", filter(t, th),
|
||||
w_win, h_win);
|
||||
sprintf(num_str, "%0.2f Hz, %dx%d, EXTENSIONS: ", filter(t, th), w_win, h_win);
|
||||
DrawStr(num_str);
|
||||
DrawStr(glGetString(GL_EXTENSIONS));
|
||||
break;
|
||||
|
|
|
@ -43,8 +43,7 @@
|
|||
|
||||
#define WHALESPEED 250.0
|
||||
|
||||
typedef struct _fishRec
|
||||
{
|
||||
typedef struct _fishRec {
|
||||
float x, y, z, phi, theta, psi, v;
|
||||
float xt, yt, zt;
|
||||
float htail, vtail;
|
||||
|
|
|
@ -57,10 +57,8 @@ WhalePilot(fishRec * fish)
|
|||
fish->theta = 0.0;
|
||||
fish->psi -= 0.5;
|
||||
|
||||
fish->x +=
|
||||
WHALESPEED * fish->v * cos(fish->psi / RAD) * cos(fish->theta / RAD);
|
||||
fish->y +=
|
||||
WHALESPEED * fish->v * sin(fish->psi / RAD) * cos(fish->theta / RAD);
|
||||
fish->x += WHALESPEED * fish->v * cos(fish->psi / RAD) * cos(fish->theta / RAD);
|
||||
fish->y += WHALESPEED * fish->v * sin(fish->psi / RAD) * cos(fish->theta / RAD);
|
||||
fish->z += WHALESPEED * fish->v * sin(fish->theta / RAD);
|
||||
}
|
||||
|
||||
|
@ -154,10 +152,8 @@ SharkPilot(fishRec * fish)
|
|||
}
|
||||
}
|
||||
|
||||
fish->x +=
|
||||
SHARKSPEED * fish->v * cos(fish->psi / RAD) * cos(fish->theta / RAD);
|
||||
fish->y +=
|
||||
SHARKSPEED * fish->v * sin(fish->psi / RAD) * cos(fish->theta / RAD);
|
||||
fish->x += SHARKSPEED * fish->v * cos(fish->psi / RAD) * cos(fish->theta / RAD);
|
||||
fish->y += SHARKSPEED * fish->v * sin(fish->psi / RAD) * cos(fish->theta / RAD);
|
||||
fish->z += SHARKSPEED * fish->v * sin(fish->theta / RAD);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,7 @@ extern void Atlantis_Display();
|
|||
|
||||
static SDL_Surface *gScreen;
|
||||
|
||||
static void
|
||||
initAttributes()
|
||||
static void initAttributes ()
|
||||
{
|
||||
// Setup attributes we want for the OpenGL context
|
||||
|
||||
|
@ -42,22 +41,18 @@ initAttributes()
|
|||
SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, value);
|
||||
}
|
||||
|
||||
static void
|
||||
printAttributes()
|
||||
static void printAttributes ()
|
||||
{
|
||||
// Print out attributes of the context we created
|
||||
int nAttr;
|
||||
int i;
|
||||
|
||||
int attr[] = { SDL_GL_RED_SIZE, SDL_GL_BLUE_SIZE, SDL_GL_GREEN_SIZE,
|
||||
SDL_GL_ALPHA_SIZE, SDL_GL_BUFFER_SIZE, SDL_GL_DEPTH_SIZE
|
||||
};
|
||||
SDL_GL_ALPHA_SIZE, SDL_GL_BUFFER_SIZE, SDL_GL_DEPTH_SIZE };
|
||||
|
||||
char *desc[] = { "Red size: %d bits\n", "Blue size: %d bits\n",
|
||||
"Green size: %d bits\n",
|
||||
char *desc[] = { "Red size: %d bits\n", "Blue size: %d bits\n", "Green size: %d bits\n",
|
||||
"Alpha size: %d bits\n", "Color buffer size: %d bits\n",
|
||||
"Depth bufer size: %d bits\n"
|
||||
};
|
||||
"Depth bufer size: %d bits\n" };
|
||||
|
||||
nAttr = sizeof(attr) / sizeof(int);
|
||||
|
||||
|
@ -69,8 +64,7 @@ printAttributes()
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
createSurface(int fullscreen)
|
||||
static void createSurface (int fullscreen)
|
||||
{
|
||||
Uint32 flags = 0;
|
||||
|
||||
|
@ -89,22 +83,19 @@ createSurface(int fullscreen)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
initGL()
|
||||
static void initGL ()
|
||||
{
|
||||
Atlantis_Init ();
|
||||
Atlantis_Reshape (gScreen->w, gScreen->h);
|
||||
}
|
||||
|
||||
static void
|
||||
drawGL()
|
||||
static void drawGL ()
|
||||
{
|
||||
Atlantis_Animate ();
|
||||
Atlantis_Display ();
|
||||
}
|
||||
|
||||
static void
|
||||
mainLoop()
|
||||
static void mainLoop ()
|
||||
{
|
||||
SDL_Event event;
|
||||
int done = 0;
|
||||
|
@ -147,7 +138,8 @@ mainLoop()
|
|||
thenTicks = nowTicks;
|
||||
if (delay < 0)
|
||||
delay = 1000/fps;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
thenTicks = SDL_GetTicks ();
|
||||
}
|
||||
|
||||
|
@ -155,15 +147,16 @@ mainLoop()
|
|||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// Init SDL video subsystem
|
||||
if ( SDL_Init (SDL_INIT_VIDEO) < 0 ) {
|
||||
|
||||
fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||
fprintf(stderr, "Couldn't initialize SDL: %s\n",
|
||||
SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Set GL context attributes
|
||||
initAttributes ();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue