Main Page | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

graviton.cpp File Reference


Detailed Description

Contains the main loop of the game.

#include <iostream>
#include <vector>
#include <stdlib.h>
#include <SDL.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include "gameobjs.h"
#include "cam.h"
#include "levels.h"
#include "menu.h"
#include "file.h"

Include dependency graph for graviton.cpp:

Include dependency graph

Functions

void print_sdl_error (char *printme)
 Wraps SDL_GetError and prints it to cerr.
void do_loop (void)
 The event loop of the game.
void calcfps (void)
 Calculates framerate and prints it in the window caption.
void movestuff (void)
 Handles all the physics of the game, essentially.
void renderit (void)
 Do the actual rendering of the window contents.
void keydownstuff (SDL_keysym *which)
 Handles keypresses.
void keyupstuff (SDL_keysym *which)
 The complement to keydownstuff().
void run_once (void)
 Initialisation code for some of the objects.
void cleanup (void)
 Delete the objects made in makelevel().
int main (int argc, char *argv[])
 Initialisation and main loop.

Variables

FileConfig cfg
 Instantiation of the configuration class.
Cam thecam
 The camera of the scene.
SDL_Surface * win = NULL
 The actual game window.
bool looping
 Used to show if the event loop is still running.
float frametime = 1
 Measures the time taken for each iteration, and passed to the physics engine.
int player1lives = 3
 Lives of player 1.
int player2lives = 3
 Unsurprisingly, the number of lives of player 2.
vector< AbsObj * > biglist
 The list of all objects in the scene.
Ship playerOne = Ship(4.0, 8.0, 4.0)
 The first ship.
Ship playerTwo = Ship(4.0, 8.0, 4.0)
 The second ship.
Grid tehgrid = Grid(200,200)
 The grid that fades in.
vector< ShipBullet * > bulletlist
 The global list of all projectiles in the system.
vector< ShipExhaust * > exhaustlist
 The global list of exhaust particles in the system.

Function Documentation

void keydownstuff SDL_keysym *  which  ) 
 

Handles keypresses.

This currently only works with hard-coded keys. Eventually the keycodes will be stored in the ship object and retrieved by this function (or on startup) to allow user configuration of keys (or joypad).

Parameters:
which The SDL structure containing the keypress in ->sym.

Here is the call graph for this function:

void keyupstuff SDL_keysym *  which  ) 
 

The complement to keydownstuff().

This does the same job as keydownstuff, except runs on KEY_UP events.

Here is the call graph for this function:

int main int  argc,
char *  argv[]
 

Initialisation and main loop.

No command line flags are currently accepted.

Parameters:
argc Number of arguments, including executable
argv List of arguments.
Returns:
Returns non-zero on error.

Todo:
Check what depth this should be set to.

Here is the call graph for this function:

void movestuff void   ) 
 

Handles all the physics of the game, essentially.

Todo:
Use the camera velocity etc. here to make the camera move smoothly on respawns.

Here is the call graph for this function:


Variable Documentation

vector<ShipBullet *> bulletlist
 

The global list of all projectiles in the system.

List of lists.

vector<ShipExhaust *> exhaustlist
 

The global list of exhaust particles in the system.

List of lists.

Grid tehgrid = Grid(200,200)
 

The grid that fades in.

I'm l337.


Generated on Mon Jan 3 15:14:19 2005 for Graviton by  doxygen 1.3.9.1