File style cleanup for the SDL 2.0 release

This commit is contained in:
Sam Lantinga 2013-05-18 14:17:52 -07:00
parent 2ac8624930
commit 0cb6385637
376 changed files with 17562 additions and 17773 deletions

View file

@ -1,7 +1,7 @@
/*
* accelerometer.c
* written by Holmes Futrell
* use however you want
* accelerometer.c
* written by Holmes Futrell
* use however you want
*/
#include "SDL.h"
@ -13,7 +13,7 @@
#define FRICTION 0.0008f /* coefficient of acceleration that opposes direction of motion */
#define GRAVITY_CONSTANT 0.004f /* how sensitive the ship is to the accelerometer */
/* If we aren't on an iPhone, then this definition ought to yield reasonable behavior */
/* If we aren't on an iPhone, then this definition ought to yield reasonable behavior */
#ifndef SDL_IPHONE_MAX_GFORCE
#define SDL_IPHONE_MAX_GFORCE 5.0f
#endif
@ -48,7 +48,7 @@ render(SDL_Renderer *renderer)
#define SINT16_MAX ((float)(0x7FFF))
/* update velocity from accelerometer
the factor SDL_IPHONE_MAX_G_FORCE / SINT16_MAX converts between
the factor SDL_IPHONE_MAX_G_FORCE / SINT16_MAX converts between
SDL's units reported from the joytick, and units of g-force, as reported by the accelerometer
*/
shipData.vx +=
@ -159,7 +159,7 @@ main(int argc, char *argv[])
{
SDL_Window *window; /* main window */
SDL_Renderer *renderer;
SDL_Renderer *renderer;
Uint32 startFrame; /* time frame began to process */
Uint32 endFrame; /* time frame ended processing */
Uint32 delay; /* time to pause waiting to draw next frame */

View file

@ -1,7 +1,7 @@
/*
* common.c
* written by Holmes Futrell
* use however you want
* common.c
* written by Holmes Futrell
* use however you want
*/
#include "common.h"
@ -9,8 +9,8 @@
#include <stdlib.h>
/*
Produces a random int x, min <= x <= max
following a uniform distribution
Produces a random int x, min <= x <= max
following a uniform distribution
*/
int
randomInt(int min, int max)
@ -19,8 +19,8 @@ randomInt(int min, int max)
}
/*
Produces a random float x, min <= x <= max
following a uniform distribution
Produces a random float x, min <= x <= max
following a uniform distribution
*/
float
randomFloat(float min, float max)

View file

@ -1,7 +1,7 @@
/*
* common.h
* written by Holmes Futrell
* use however you want
* common.h
* written by Holmes Futrell
* use however you want
*/
#define SCREEN_WIDTH 320

View file

@ -1,7 +1,7 @@
/*
* fireworks.c
* written by Holmes Futrell
* use however you want
* fireworks.c
* written by Holmes Futrell
* use however you want
*/
#include "SDL.h"
@ -17,11 +17,11 @@
static GLuint particleTextureID; /* OpenGL particle texture id */
static SDL_bool pointSizeExtensionSupported; /* is GL_OES_point_size_array supported ? */
/*
used to describe what type of particle a given struct particle is.
emitter - this particle flies up, shooting off trail particles, then finally explodes into dust particles.
trail - shoots off, following emitter particle
dust - radiates outwards from emitter explosion
/*
used to describe what type of particle a given struct particle is.
emitter - this particle flies up, shooting off trail particles, then finally explodes into dust particles.
trail - shoots off, following emitter particle
dust - radiates outwards from emitter explosion
*/
enum particleType
{
@ -30,7 +30,7 @@ enum particleType
dust
};
/*
struct particle is used to describe each particle displayed on screen
struct particle is used to describe each particle displayed on screen
*/
struct particle
{
@ -57,8 +57,8 @@ int nextPowerOfTwo(int x);
void drawParticles();
void stepParticles(void);
/* helper function (used in texture loading)
returns next power of two greater than or equal to x
/* helper function (used in texture loading)
returns next power of two greater than or equal to x
*/
int
nextPowerOfTwo(int x)
@ -70,8 +70,8 @@ nextPowerOfTwo(int x)
return val;
}
/*
steps each active particle by timestep MILLESECONDS_PER_FRAME
/*
steps each active particle by timestep MILLESECONDS_PER_FRAME
*/
void
stepParticles(void)
@ -145,13 +145,13 @@ stepParticles(void)
curr++;
}
/* the number of active particles is computed as the difference between
old number of active particles, where slot points, and the
old number of active particles, where slot points, and the
new size of the array, where particles points */
num_active_particles = slot - particles;
}
/*
This draws all the particles shown on screen
This draws all the particles shown on screen
*/
void
drawParticles()
@ -177,7 +177,7 @@ drawParticles()
}
/*
This causes an emitter to explode in a circular bloom of dust particles
This causes an emitter to explode in a circular bloom of dust particles
*/
void
explodeEmitter(struct particle *emitter)
@ -219,7 +219,7 @@ explodeEmitter(struct particle *emitter)
}
/*
This spawns a trail particle from an emitter
This spawns a trail particle from an emitter
*/
void
spawnTrailFromEmitter(struct particle *emitter)
@ -254,7 +254,7 @@ spawnTrailFromEmitter(struct particle *emitter)
}
/*
spawns a new emitter particle at the bottom of the screen
spawns a new emitter particle at the bottom of the screen
destined for the point (x,y).
*/
void
@ -313,7 +313,7 @@ initializeParticles(void)
}
/*
loads the particle texture
loads the particle texture
*/
void
initializeTexture()
@ -375,7 +375,7 @@ main(int argc, char *argv[])
}
/* seed the random number generator */
srand(time(NULL));
/*
/*
request some OpenGL parameters
that may speed drawing
*/

View file

@ -1,7 +1,7 @@
/*
* happy.c
* written by Holmes Futrell
* use however you want
* happy.c
* written by Holmes Futrell
* use however you want
*/
#include "SDL.h"
@ -20,8 +20,8 @@ static struct
} faces[NUM_HAPPY_FACES];
/*
Sets initial positions and velocities of happyfaces
units of velocity are pixels per millesecond
Sets initial positions and velocities of happyfaces
units of velocity are pixels per millesecond
*/
void
initializeHappyFaces()
@ -94,7 +94,7 @@ render(SDL_Renderer *renderer)
}
/*
loads the happyface graphic into a texture
loads the happyface graphic into a texture
*/
void
initializeTexture(SDL_Renderer *renderer)
@ -125,7 +125,7 @@ main(int argc, char *argv[])
{
SDL_Window *window;
SDL_Renderer *renderer;
SDL_Renderer *renderer;
Uint32 startFrame;
Uint32 endFrame;
Uint32 delay;

View file

@ -1,7 +1,7 @@
/*
* keyboard.c
* written by Holmes Futrell
* use however you want
* keyboard.c
* written by Holmes Futrell
* use however you want
*/
#import "SDL.h"
@ -97,14 +97,14 @@ fontMapping map[TABLE_SIZE] = {
};
/*
This function maps an SDL_KeySym to an index in the bitmap font.
It does so by scanning through the font mapping table one entry
at a time.
If a match is found (scancode and allowed modifiers), the proper
index is returned.
If there is no entry for the key, -1 is returned
This function maps an SDL_KeySym to an index in the bitmap font.
It does so by scanning through the font mapping table one entry
at a time.
If a match is found (scancode and allowed modifiers), the proper
index is returned.
If there is no entry for the key, -1 is returned
*/
int
keyToIndex(SDL_Keysym key)
@ -125,8 +125,8 @@ keyToIndex(SDL_Keysym key)
return index;
}
/*
This function returns and x,y position for a given character number.
/*
This function returns and x,y position for a given character number.
It is used for positioning each character of text
*/
void

View file

@ -1,7 +1,7 @@
/*
* mixer.c
* written by Holmes Futrell
* use however you want
* mixer.c
* written by Holmes Futrell
* use however you want
*/
#import "SDL.h"
@ -100,7 +100,7 @@ loadSound(const char *file, struct sound *s)
if (result == -1) {
fatalError("could not build audio CVT");
} else if (result != 0) {
/*
/*
this happens when the .wav format differs from the output format.
we convert the .wav buffer here
*/
@ -179,8 +179,8 @@ render(SDL_Renderer *renderer)
}
/*
finds a sound channel in the mixer for a sound
and sets it up to start playing
finds a sound channel in the mixer for a sound
and sets it up to start playing
*/
int
playSound(struct sound *s)
@ -225,9 +225,9 @@ playSound(struct sound *s)
return selected_channel;
}
/*
Called from SDL's audio system. Supplies sound input with data by mixing together all
currently playing sound effects.
/*
Called from SDL's audio system. Supplies sound input with data by mixing together all
currently playing sound effects.
*/
void
audioCallback(void *userdata, Uint8 * stream, int len)
@ -273,7 +273,7 @@ main(int argc, char *argv[])
int done; /* has user tried to quit ? */
SDL_Window *window; /* main window */
SDL_Renderer *renderer;
SDL_Renderer *renderer;
SDL_Event event;
Uint32 startFrame; /* holds when frame started processing */
Uint32 endFrame; /* holds when frame ended processing */

View file

@ -1,7 +1,7 @@
/*
* rectangles.c
* written by Holmes Futrell
* use however you want
* rectangles.c
* written by Holmes Futrell
* use however you want
*/
#include "SDL.h"
@ -39,7 +39,7 @@ main(int argc, char *argv[])
{
SDL_Window *window;
SDL_Renderer *renderer;
SDL_Renderer *renderer;
int done;
SDL_Event event;
@ -59,7 +59,7 @@ main(int argc, char *argv[])
fatalError("Could not initialize Window");
}
renderer = SDL_CreateRenderer(window, -1, 0);
if (!renderer) {
if (!renderer) {
fatalError("Could not create renderer");
}

View file

@ -1,7 +1,7 @@
/*
* touch.c
* written by Holmes Futrell
* use however you want
* touch.c
* written by Holmes Futrell
* use however you want
*/
#include "SDL.h"
@ -14,8 +14,8 @@
static SDL_Texture *brush = 0; /* texture for the brush */
/*
draws a line from (startx, starty) to (startx + dx, starty + dy)
this is accomplished by drawing several blots spaced PIXELS_PER_ITERATION apart
draws a line from (startx, starty) to (startx + dx, starty + dy)
this is accomplished by drawing several blots spaced PIXELS_PER_ITERATION apart
*/
void
drawLine(SDL_Renderer *renderer, float startx, float starty, float dx, float dy)
@ -48,7 +48,7 @@ drawLine(SDL_Renderer *renderer, float startx, float starty, float dx, float dy)
}
/*
loads the brush texture
loads the brush texture
*/
void
initializeTexture(SDL_Renderer *renderer)
@ -78,7 +78,7 @@ main(int argc, char *argv[])
Uint8 state; /* mouse (touch) state */
SDL_Event event;
SDL_Window *window; /* main window */
SDL_Renderer *renderer;
SDL_Renderer *renderer;
int done; /* does user want to quit? */
/* initialize SDL */