|
SDL
2.0
|
Include dependency graph for fireworks.c:Go to the source code of this file.
Data Structures | |
| struct | particle |
Macros | |
| #define | ACCEL 0.0001f /* acceleration due to gravity, units in pixels per millesecond squared */ |
| #define | WIND_RESISTANCE 0.00005f /* acceleration per unit velocity due to wind resistance */ |
| #define | MAX_PARTICLES 2000 /* maximum number of particles displayed at once */ |
Enumerations | |
| enum | particleType { emitter = 0, trail, dust } |
Functions | |
| void | spawnTrailFromEmitter (struct particle *emitter) |
| void | spawnEmitterParticle (GLfloat x, GLfloat y) |
| void | explodeEmitter (struct particle *emitter) |
| void | initializeParticles (void) |
| void | initializeTexture () |
| int | nextPowerOfTwo (int x) |
| void | drawParticles () |
| void | stepParticles (double deltaTime) |
| int | main (int argc, char *argv[]) |
Variables | |
| static GLuint | particleTextureID |
| static SDL_bool | pointSizeExtensionSupported |
| static float | pointSizeScale |
| struct particle | particles [MAX_PARTICLES] |
| static int | num_active_particles |
| static int | screen_w |
| static int | screen_h |
| #define ACCEL 0.0001f /* acceleration due to gravity, units in pixels per millesecond squared */ |
Definition at line 13 of file fireworks.c.
Referenced by spawnEmitterParticle(), and stepParticles().
| #define MAX_PARTICLES 2000 /* maximum number of particles displayed at once */ |
Definition at line 15 of file fireworks.c.
Referenced by explodeEmitter(), spawnEmitterParticle(), and spawnTrailFromEmitter().
| #define WIND_RESISTANCE 0.00005f /* acceleration per unit velocity due to wind resistance */ |
Definition at line 14 of file fireworks.c.
Referenced by stepParticles().
| enum particleType |
| Enumerator | |
|---|---|
| emitter | |
| trail | |
| dust | |
Definition at line 26 of file fireworks.c.
| void drawParticles | ( | ) |
Definition at line 158 of file fireworks.c.
References GL_COLOR_BUFFER_BIT, GL_FLOAT, GL_POINTS, GL_UNSIGNED_BYTE, glClear(), glColorPointer(), glDrawArrays(), glVertexPointer(), num_active_particles, particles, and pointSizeExtensionSupported.
Referenced by main().
Definition at line 184 of file fireworks.c.
References particle::color, cos(), dust, i, particle::isActive, MAX_PARTICLES, num_active_particles, particles, pointSizeScale, randomFloat(), sin(), particle::size, particle::type, particle::x, particle::xvel, particle::y, and particle::yvel.
Referenced by stepParticles().
| void initializeTexture | ( | ) |
Definition at line 320 of file fireworks.c.
References fatalError(), GL_LINEAR, GL_RGBA, GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_TEXTURE_MIN_FILTER, GL_UNSIGNED_BYTE, glBindTexture(), glGenTextures(), glTexImage2D, glTexParameteri(), SDL_Surface::h, nextPowerOfTwo(), NULL, particleTextureID, SDL_Surface::pixels, SDL_BlitSurface, SDL_CreateRGBSurface, SDL_FreeSurface, SDL_LoadBMP, SDL_PIXELFORMAT_ABGR8888, SDL_PixelFormatEnumToMasks, and SDL_Surface::w.
Referenced by main().
| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
Definition at line 363 of file fireworks.c.
References context, done, drawParticles(), fatalError(), GL_BLEND, GL_COLOR_ARRAY, GL_CULL_FACE, GL_DEPTH_TEST, GL_MODELVIEW, GL_ONE, GL_PROJECTION, GL_SRC_ALPHA, GL_TEXTURE_2D, GL_VERTEX_ARRAY, glBlendFunc(), glDeleteTextures(), glDisable(), glEnable(), glEnableClientState(), glLoadIdentity(), glMatrixMode(), glPointSize(), glTexEnvi(), glViewport(), initializeTexture(), NULL, particleTextureID, pointSizeExtensionSupported, pointSizeScale, screen_h, screen_w, SDL_CreateWindow, SDL_Delay, SDL_GetMouseState, SDL_GetWindowSize, SDL_GL_ACCELERATED_VISUAL, SDL_GL_ALPHA_SIZE, SDL_GL_BLUE_SIZE, SDL_GL_CONTEXT_MAJOR_VERSION, SDL_GL_CONTEXT_MINOR_VERSION, SDL_GL_CreateContext, SDL_GL_DEPTH_SIZE, SDL_GL_ExtensionSupported, SDL_GL_GetDrawableSize, SDL_GL_GREEN_SIZE, SDL_GL_RED_SIZE, SDL_GL_RETAINED_BACKING, SDL_GL_SetAttribute, SDL_GL_SwapWindow, SDL_Init, SDL_INIT_VIDEO, SDL_MOUSEBUTTONDOWN, SDL_PollEvent, SDL_Quit, SDL_QUIT, SDL_WINDOW_ALLOW_HIGHDPI, SDL_WINDOW_BORDERLESS, SDL_WINDOW_OPENGL, spawnEmitterParticle(), stepParticles(), SDL_Event::type, updateDeltaTime(), particle::x, and particle::y.
| int nextPowerOfTwo | ( | int | x | ) |
Definition at line 262 of file fireworks.c.
References ACCEL, particle::color, emitter, particle::isActive, MAX_PARTICLES, num_active_particles, particles, pointSizeScale, screen_h, particle::size, particle::type, particle::x, particle::xvel, particle::y, and particle::yvel.
Referenced by main().
Definition at line 226 of file fireworks.c.
References particle::color, particle::isActive, MAX_PARTICLES, num_active_particles, particles, pointSizeScale, randomFloat(), particle::size, trail, particle::type, particle::x, particle::xvel, particle::y, and particle::yvel.
Referenced by stepParticles().
| void stepParticles | ( | double | deltaTime | ) |
Definition at line 77 of file fireworks.c.
References ACCEL, particle::color, dust, emitter, explodeEmitter(), i, particle::isActive, num_active_particles, particles, screen_h, screen_w, particle::size, spawnTrailFromEmitter(), particle::type, WIND_RESISTANCE, particle::x, particle::xvel, particle::y, and particle::yvel.
Referenced by main().
|
static |
Definition at line 47 of file fireworks.c.
Referenced by drawParticles(), explodeEmitter(), initializeParticles(), spawnEmitterParticle(), spawnTrailFromEmitter(), and stepParticles().
| struct particle particles[MAX_PARTICLES] |
Referenced by drawParticles(), explodeEmitter(), spawnEmitterParticle(), spawnTrailFromEmitter(), and stepParticles().
|
static |
Definition at line 17 of file fireworks.c.
Referenced by initializeTexture(), and main().
|
static |
Definition at line 18 of file fireworks.c.
Referenced by drawParticles(), and main().
|
static |
Definition at line 19 of file fireworks.c.
Referenced by explodeEmitter(), main(), spawnEmitterParticle(), and spawnTrailFromEmitter().
|
static |
Definition at line 48 of file fireworks.c.
Referenced by main(), spawnEmitterParticle(), and stepParticles().
|
static |
Definition at line 48 of file fireworks.c.
Referenced by main(), and stepParticles().