fixed lots of pretties namely ){ -> ) {
authorIvan Hernanez <iturtleman128@gmail.com>
Thu, 14 Jun 2012 20:43:03 +0000 (15:43 -0500)
committerIvan Hernanez <iturtleman128@gmail.com>
Thu, 14 Jun 2012 20:43:03 +0000 (15:43 -0500)
21 files changed:
Animation.cpp
Animation.h
Background.cpp
Background.h
Collision.cpp
Collision.h
Font.cpp
Game.cpp
Game.h
HUD.h
Level.cpp
Level.h
LevelFns.h
LoadResources.cpp
Sprite.cpp
Sprite.h
Text.cpp
WorldObject.cpp
WorldObject.h
fns.cpp
fns.h

index 20b9cdd..c1974b0 100644 (file)
@@ -55,7 +55,7 @@ int Animation::loadAnimation(std::string animFile)
                        mFrames = new SpriteFrame[mNumFrames];
                        mBuilt = 1;
                        //read out frames
-                       for(unsigned int i=0; i<doc.size(); i++){
+                       for(unsigned int i=0; i<doc.size(); i++) {
                                /** File name */
                                file=doc[i]["file"].to<string>();
 
@@ -71,14 +71,14 @@ int Animation::loadAnimation(std::string animFile)
                                double x=doc[i]["offset"]["x"].to<double>();
                                double y=doc[i]["offset"]["y"].to<double>();
                                /** Collision data */
-                               for(unsigned int j=0; j<doc[i]["collision"].size();j++){
-                                       if(doc[i]["collision"][j]["type"].to<string>()=="circle"){
+                               for(unsigned int j=0; j<doc[i]["collision"].size();j++) {
+                                       if(doc[i]["collision"][j]["type"].to<string>()=="circle") {
                                                double xOffset = doc[i]["collision"][j]["offset"]["x"].to<double>();
                                                double yOffset = doc[i]["collision"][j]["offset"]["y"].to<double>();
                                                double radius = doc[i]["collision"][j]["radius"].to<double>();
                                                mFrames[count].collisionData.push_back(new CollisionCircle(Point2D(xOffset, yOffset), radius));
                                        }
-                                       else if(doc[i]["collision"][j]["type"].to<string>()=="rectangle"){
+                                       else if(doc[i]["collision"][j]["type"].to<string>()=="rectangle") {
                                                double xOffset = doc[i]["collision"][j]["offset"]["x"].to<double>();
                                                double yOffset = doc[i]["collision"][j]["offset"]["y"].to<double>();
                                                double width = doc[i]["collision"][j]["width"].to<double>();
@@ -183,10 +183,10 @@ int Animation::loadAnimation(std::string animFile)
                //                      /** Collision data */
                //                      char c;
                //                      value>>c;
-               //                      if(c == '('){
+               //                      if(c == '(') {
                //                              value>>c;
-               //                              while(c != ')'){
-               //                                      if(c == 'n'){
+               //                              while(c != ')') {
+               //                                      if(c == 'n') {
                //                                              value>>c;
                //                                              continue;
                //                                      }
index 0d6434d..9c445a3 100644 (file)
@@ -34,8 +34,8 @@ public:
 
        //Methods
        int loadAnimation(std::string animFile);/**< Loads the Animations from a file in the specified format. */
-       bool operator==(Animation a){return mName==a.mName;}
-       bool operator!=(Animation a){return mName!=a.mName;}
+       bool operator==(Animation a) {return mName==a.mName;}
+       bool operator!=(Animation a) {return mName!=a.mName;}
 };
 
 #endif
index ed1a980..a824e43 100644 (file)
@@ -10,7 +10,7 @@ WorldObject(name,-10000, pos),
        load(filename);
        cout<<"background \""<<mName<<"\" created"<<endl;       
 }
-void Background::draw(){
+void Background::draw() {
        glEnable(GL_BLEND);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        glColor4f(1, 1, 1, mTransparency);
@@ -40,11 +40,11 @@ void Background::draw(){
        glLoadIdentity();
 }
 
-void Background::update(){
+void Background::update() {
 }
 
 
-int Background::load(std::string filename){
+int Background::load(std::string filename) {
        /** Load image for Frame */
        SDL_Surface *temp=NULL;
        if((temp = LoadImage("Backgrounds/"+filename)) == NULL) return -1;//Load image for Frame
@@ -108,15 +108,15 @@ int Background::load(std::string filename){
        return 0;
 }
 
-void Background::setWrap(bool tf){
+void Background::setWrap(bool tf) {
        wrapping=tf;
 }
 
-bool Background::getWrap(){
+bool Background::getWrap() {
        return wrapping;
 }
 
-void Background::drawCollisions(){
+void Background::drawCollisions() {
        WorldObject::drawCollisions(collisionData, mPos);
 }
 
index 8ce2d99..c981137 100644 (file)
@@ -33,10 +33,10 @@ class Background : public WorldObject{
        );
        void draw();/**< Draw background. */
        void update();/**< Update to run each loop */
-       string getName(){ return mName; }/** Returns name. */
-       void setName(string name){ mName = name; }/** Set Name. */
+       string getName() { return mName; }/** Returns name. */
+       void setName(string name) { mName = name; }/** Set Name. */
        int load(string name="default");///< Loads a Bacground by name.
-       SizeD getPosition(){return mPos;}
+       SizeD getPosition() {return mPos;}
        void setWrap(bool tf);
        bool getWrap();
        void drawCollisions();/**< Draws Collision data for the Object (from outside) */
index 6d82192..81bdf3f 100644 (file)
@@ -24,7 +24,7 @@ void Sulock(SDL_Surface *screen)
 void DrawPixel(SDL_Surface *screen, int x, int y, Uint32 c)
 {
        //keep in bounds
-       if(x>0 && y>0 && x < screen->w && y < screen->h){
+       if(x>0 && y>0 && x < screen->w && y < screen->h) {
                Uint32 color = c&0xFFFFFF;
                //Uint32 color1 = SDL_MapRGB(screen->format, c&0xff, c&0xFF00, c&0xFF0000);
                switch (screen->format->BytesPerPixel)
@@ -77,7 +77,7 @@ void DrawPixel(SDL_Surface *screen, int x, int y, Uint32 c)
        \param pos This is the relative position to draw the points (not & because may want to have an added value pushed in)
        \param color the color to be drawn
 */
-void DrawCircle(SDL_Surface* screen, const Point2D wPos, const Point2D pos, Uint32 color){
+void DrawCircle(SDL_Surface* screen, const Point2D wPos, const Point2D pos, Uint32 color) {
        DrawPixel(screen, int(wPos.x + pos.x), int(wPos.y + pos.y), color);
        DrawPixel(screen, int(wPos.x - pos.x), int(wPos.y + pos.y), color);
        DrawPixel(screen, int(wPos.x + pos.x), int(wPos.y - pos.y), color);
@@ -94,14 +94,14 @@ void DrawCircle(SDL_Surface* screen, const Point2D wPos, const Point2D pos, Uint
        \param end This is the end position to draw the point (not & because may want to have an added value pushed in)
        \param color the color to be drawn
 */
-void DrawLine(SDL_Surface* screen, const Point2D start, Point2D end, Uint32 color){
+void DrawLine(SDL_Surface* screen, const Point2D start, Point2D end, Uint32 color) {
        Slock(screen);
        //values for calculation and max values
        int x,y;//start as low vals used for algorithm
        int xMax, yMax;
        
        //if the end point is lower swap em
-       if(end.y < start.y){
+       if(end.y < start.y) {
                x = (int)end.x;
                y = (int)end.y;
                xMax = (int)start.x;
@@ -124,8 +124,8 @@ void DrawLine(SDL_Surface* screen, const Point2D start, Point2D end, Uint32 colo
                int sum = 2 * dY + dX;
                DrawPixel(screen, x, y, color);
 
-               while( x < xMax){
-                       if(sum < 0){
+               while( x < xMax) {
+                       if(sum < 0) {
                                sum += 2 * dX;
                                y++;
                        }
@@ -135,7 +135,7 @@ void DrawLine(SDL_Surface* screen, const Point2D start, Point2D end, Uint32 colo
                }
        }
        else {
-               while(y < yMax){
+               while(y < yMax) {
                        DrawPixel(screen, x, y, color);
                        y++;
                }
@@ -143,7 +143,7 @@ void DrawLine(SDL_Surface* screen, const Point2D start, Point2D end, Uint32 colo
        Sulock(screen);
 }
 
-void CollisionRectangle::draw(const Point2D& pos){
+void CollisionRectangle::draw(const Point2D& pos) {
        Point2D nPos = pos + mPos;
        //top
        Point2D startPos = nPos + Point2D(-width/2, -height/2);
@@ -163,14 +163,14 @@ void CollisionRectangle::draw(const Point2D& pos){
        DrawLine(Game::game()->Screen(), startPos, endPos, color);
 }
 
-void CollisionCircle::draw(const Point2D& pos){
+void CollisionCircle::draw(const Point2D& pos) {
        Slock(Game::game()->Screen());
        int x=0,y=(int)radius;///<The relative x,y pos
        int midpt = 1-(int)radius;///<the midpt of the circle
        //draw pts
        DrawCircle(Game::game()->Screen(), pos + mPos, Point2D(x,y), color);
        //calculate other points
-       while(x<y){
+       while(x<y) {
                x++;
                if(midpt<0)
                        midpt += 2 * x + 1;
@@ -184,8 +184,8 @@ void CollisionCircle::draw(const Point2D& pos){
        Sulock(Game::game()->Screen());
 }
 
-bool Collision::checkCollisions(const vector<Collision*>& c, const Point2D cPos, const Point2D pos){
-       for(unsigned int i=0; i < c.size(); i++){
+bool Collision::checkCollisions(const vector<Collision*>& c, const Point2D cPos, const Point2D pos) {
+       for(unsigned int i=0; i < c.size(); i++) {
                if(collision(c[i], cPos, pos))//if any are true return true then and there
                        return true;
        }
@@ -193,7 +193,7 @@ bool Collision::checkCollisions(const vector<Collision*>& c, const Point2D cPos,
 }
 
 bool CollisionRectangle::collision(const Collision *c, const Point2D cPos, const Point2D pos) const {
-       if(const CollisionRectangle* rec = dynamic_cast<const CollisionRectangle*>(c)){
+       if(const CollisionRectangle* rec = dynamic_cast<const CollisionRectangle*>(c)) {
                ///check rect vs rect really just axis aligned box check (simpler)
                double r1Left = -width/2 + mPos.x + pos.x;
                double r1Right = width/2 + mPos.x + pos.x;
@@ -209,7 +209,7 @@ bool CollisionRectangle::collision(const Collision *c, const Point2D cPos, const
                bool outsideY = r1Bottom < r2Top || r1Top > r2Bottom;
                return !(outsideY || outsideX);
        }
-       else if(dynamic_cast<const CollisionCircle*>(c)){
+       else if(dynamic_cast<const CollisionCircle*>(c)) {
                return c->collision(this, cPos, pos);
        }
        //if something breaks bad
@@ -220,7 +220,7 @@ bool CollisionCircle::collision(const Collision *c, const Point2D cPos, const Po
        if (const CollisionRectangle* r = dynamic_cast<const CollisionRectangle*>(c)) {
                collision(r, cPos, pos);///call the circle rect fn
        }
-       else if(const CollisionCircle* col = dynamic_cast<const CollisionCircle*>(c)){
+       else if(const CollisionCircle* col = dynamic_cast<const CollisionCircle*>(c)) {
                ///check circle vs circle
                if(((col->mPos + cPos) - (mPos + pos)).length() <= (col->radius + radius))
                        return true;
index cb6b518..55ddf2a 100644 (file)
@@ -17,7 +17,7 @@ using std::string;
 class Collision
 {
 public:
-       Collision():mPos(0.0,0.0),color(0xFF00FF00){ }
+       Collision():mPos(0.0,0.0),color(0xFF00FF00) { }
        Point2D mPos;/**< The position of the center of the collision data */
        /** 
                Check collision with objects
@@ -54,8 +54,8 @@ protected:
 class CollisionRectangle : public Collision
 {
 public:
-       CollisionRectangle():width(1.0),height(1.0){};
-       CollisionRectangle(Point2D pt, double w, double h):width(w),height(h){ mPos = pt;}
+       CollisionRectangle():width(1.0),height(1.0) {};
+       CollisionRectangle(Point2D pt, double w, double h):width(w),height(h) { mPos = pt;}
        double width;/**< Rectangle's width */
        double height;/**< Rectangle's height */
        /** 
@@ -82,7 +82,7 @@ class CollisionCircle : public Collision
 {
 public:
        CollisionCircle();
-       CollisionCircle(Point2D pt, double r) : radius(r){ mPos = pt; }
+       CollisionCircle(Point2D pt, double r) : radius(r) { mPos = pt; }
        double radius; /**< The raidus of the circle */
        /**
                This does collision between Rectangles and Circles
index 08dd95f..3e0153b 100644 (file)
--- a/Font.cpp
+++ b/Font.cpp
@@ -6,7 +6,7 @@
 using namespace std;
 
 
-Font::Font( FontType t, int s ) :  type(t), size(s), count(1){
+Font::Font( FontType t, int s ) :  type(t), size(s), count(1) {
        // Load a font
        fontFile = type==English ? "FreeSans.ttf" : "Japanese.ttf";
        font = TTF_OpenFont(fontFile.c_str(), size);
@@ -14,7 +14,7 @@ Font::Font( FontType t, int s ) :  type(t), size(s), count(1){
                cerr << "TTF_OpenFont() Failed: " << TTF_GetError() << endl;
 }
 
-Font::Font( int s ) : type(English), size(s), count(1){
+Font::Font( int s ) : type(English), size(s), count(1) {
        // Load a font
        fontFile = "FreeSans.ttf";
        font = TTF_OpenFont(fontFile.c_str(), size);
@@ -24,12 +24,12 @@ Font::Font( int s ) : type(English), size(s), count(1){
 
 }
 
-Font::~Font(){
+Font::~Font() {
        TTF_CloseFont(font);
 }
 
-void Font::setSize(int s){
-       if(s!=size){
+void Font::setSize(int s) {
+       if(s!=size) {
                TTF_CloseFont(font);
                font = TTF_OpenFont(fontFile.c_str(), s);
        }
index 49b3d6b..b26ef84 100644 (file)
--- a/Game.cpp
+++ b/Game.cpp
@@ -41,7 +41,7 @@ Game* Game::m_instance = NULL;
 Calling the constructor publicly is not allowed.
 The constructor is private and is only called by this Instance function.
 */
-Game* Game::game(){
+Game* Game::game() {
        if(!m_instance)
                m_instance = new Game;
        return m_instance;
@@ -108,16 +108,16 @@ int Game::getLevelIndex()
        return mCurrentLevel;
 }
 
-void Game::setCurrentLevel(string name){
-       if(mCurrentLevel<0){
+void Game::setCurrentLevel(string name) {
+       if(mCurrentLevel<0) {
                loadCurrentLevel(name);
                return;
        }
        else
        {
                mLevels[mCurrentLevel]->unload();
-               for(unsigned int i=0, count = mLevels.size(); i < count; i++){
-                       if(mLevels[i]->getName() == name){
+               for(unsigned int i=0, count = mLevels.size(); i < count; i++) {
+                       if(mLevels[i]->getName() == name) {
                                mCurrentLevel=i;
                                return;
                        }
@@ -126,9 +126,9 @@ void Game::setCurrentLevel(string name){
        cout<<"Level "<<name<<" does not exist."<<endl;
 }
 
-void Game::loadCurrentLevel(string name){
-       for(unsigned int i=0, count = mLevels.size(); i < count; i++){
-               if(mLevels[i]->getName() == name){
+void Game::loadCurrentLevel(string name) {
+       for(unsigned int i=0, count = mLevels.size(); i < count; i++) {
+               if(mLevels[i]->getName() == name) {
                        LoadingLevel = mLevels[i];
                        this->mLevels[i]->load();
                        LoadingLevel = NULL;
diff --git a/Game.h b/Game.h
index 78849f1..3b53c4d 100644 (file)
--- a/Game.h
+++ b/Game.h
@@ -61,7 +61,7 @@ public:
        void run();
 
        /** Returns the main screen to allow for drawing */
-       SDL_Surface* Screen(){ return mScreen; }
+       SDL_Surface* Screen() { return mScreen; }
 
        /** Retrns the Current FPS of the game */
        Uint32 getFPS() { return currentFPS; }
diff --git a/HUD.h b/HUD.h
index 8f92339..071fb5d 100644 (file)
--- a/HUD.h
+++ b/HUD.h
@@ -3,7 +3,7 @@
 class HUD
 {
 public:
-       HUD(){}
+       HUD() {}
 //
 //      TextScroller scroller;
 //      TextFader fader;
index 0b99d85..38a7e07 100644 (file)
--- a/Level.cpp
+++ b/Level.cpp
@@ -82,7 +82,7 @@ void Level::DrawSprites()
 
 void Level::DrawCollisions()
 {
-       if(Game::game()->ShowCollisions){
+       if(Game::game()->ShowCollisions) {
                mBackground->drawCollisions();
                for (size_t i=0; i<mWorldObjects.size(); ++i) {
                        mWorldObjects[i]->drawCollisions();
@@ -105,7 +105,7 @@ void Level::postEvent(SDL_Event event)
 }
 
 /** Will handle all movement and dynamic triggers. */
-void Level::update(){
+void Level::update() {
        sort(mWorldObjects.begin(),mWorldObjects.end());
        if (Loaded)
        {
@@ -117,7 +117,7 @@ void Level::update(){
                                unload();
                                return;
                        }
-                       for(unsigned int i=0, size = mWorldObjects.size(); i<size; i++){
+                       for(unsigned int i=0, size = mWorldObjects.size(); i<size; i++) {
                                if (!mWinCondition())
                                        mWorldObjects[i]->update();
                                else
@@ -126,30 +126,30 @@ void Level::update(){
                                        return;
                                }
                        }
-                       for(unsigned int i=0, size = ToRemove.size(); i<size; i++){
+                       for(unsigned int i=0, size = ToRemove.size(); i<size; i++) {
                                {
                                        // Try to remove from mWorldObjects,
                                        // if failed see if it's currently pending add
                                        bool removed=false;
-                                       for(vector<WorldObject* >::iterator ptr = mWorldObjects.begin(); ptr != mWorldObjects.end(); ptr++){
-                                               if(*ptr == ToRemove[i]){
+                                       for(vector<WorldObject* >::iterator ptr = mWorldObjects.begin(); ptr != mWorldObjects.end(); ptr++) {
+                                               if(*ptr == ToRemove[i]) {
                                                        delete *ptr;
                                                        mWorldObjects.erase(ptr);
                                                        removed=true;
                                                        break;
                                                }
                                        }
-                                       if(removed){
-                                               for(vector<Sprite* >::iterator ptr = mSprites.begin(); ptr != mSprites.end(); ptr++){
-                                                       if(*ptr == ToRemove[i]){
+                                       if(removed) {
+                                               for(vector<Sprite* >::iterator ptr = mSprites.begin(); ptr != mSprites.end(); ptr++) {
+                                                       if(*ptr == ToRemove[i]) {
                                                                mSprites.erase(ptr);
                                                                removed=true;
                                                                break;
                                                        }
                                                }
                                        } else{
-                                               for(vector<WorldObject* >::iterator ptr = ToAdd.begin(); ptr != ToAdd.end(); ptr++){
-                                                       if(*ptr == ToRemove[i]){
+                                               for(vector<WorldObject* >::iterator ptr = ToAdd.begin(); ptr != ToAdd.end(); ptr++) {
+                                                       if(*ptr == ToRemove[i]) {
                                                                ToAdd.erase(ptr);
                                                                break;
                                                        }
@@ -158,7 +158,7 @@ void Level::update(){
                                }
                        }
                        ToRemove.clear();
-                       for(unsigned int i=0, size = ToAdd.size(); i<size; i++){
+                       for(unsigned int i=0, size = ToAdd.size(); i<size; i++) {
                                mWorldObjects.push_back(ToAdd[i]);
                                if(Sprite* sp = dynamic_cast<Sprite*>(ToAdd[i]))
                                        mSprites.push_back(sp);
@@ -180,24 +180,24 @@ void Level::update(){
        }
 }
 
-void Level::load(){
+void Level::load() {
        clearData();
        mLoadBehavior();
        /// \todo Add menu
        Loaded = true;
 }
 
-void Level::unload(){
+void Level::unload() {
        mUnloadBehavior();
        clearData();
        Loaded = false;
 }
 
-void Level::clearData(){
+void Level::clearData() {
        /// \todo stop and delete sound
 
        //clear WorldObjects
-       for(unsigned int i=0,size=mWorldObjects.size(); i<size; i++){
+       for(unsigned int i=0,size=mWorldObjects.size(); i<size; i++) {
                delete mWorldObjects[i];
        }
        mWorldObjects.clear();
@@ -206,7 +206,7 @@ void Level::clearData(){
        //clear textures
        int count = mTextures.size();
        vector<GLuint> texts = vector<GLuint>();
-       for(map<string, Texture>::iterator it = mTextures.begin(),end=mTextures.end();it!=end;it++){
+       for(map<string, Texture>::iterator it = mTextures.begin(),end=mTextures.end();it!=end;it++) {
                glDeleteTextures(1, &it->second);
        }
        mTextures.clear();
@@ -222,67 +222,67 @@ void Level::clearData(){
 
 }
 
-void Level::addSprite(Sprite* sp){
+void Level::addSprite(Sprite* sp) {
        ToAdd.push_back(sp);
 }
 
-Sprite* Level::getSprite(string name){
-       for(int i=0, count=mSprites.size(); i < count; i++){
-               if(mSprites[i]->getName()==name){
+Sprite* Level::getSprite(string name) {
+       for(int i=0, count=mSprites.size(); i < count; i++) {
+               if(mSprites[i]->getName()==name) {
                        return mSprites[i];
                }
        }
        return NULL;
 }
 
-void Level::removeSprite(Sprite* sp){
+void Level::removeSprite(Sprite* sp) {
        ToRemove.push_back(sp);
 }
 
-void Level::addAnimation(Animation anim){
+void Level::addAnimation(Animation anim) {
        mAnims.push_back(anim);
 }
 
-Animation* Level::getAnimation(string name){
-       for(int i=0, count=mAnims.size(); i < count; i++){
-               if(mAnims[i].mName==name){
+Animation* Level::getAnimation(string name) {
+       for(int i=0, count=mAnims.size(); i < count; i++) {
+               if(mAnims[i].mName==name) {
                        return &mAnims[i];
                }
        }
        return NULL;
 }
 
-void Level::removeAnimation(Animation anim){
-       for(vector<Animation>::iterator ptr = mAnims.begin(); ptr != mAnims.end(); ptr++){
-               if(*ptr == anim){
+void Level::removeAnimation(Animation anim) {
+       for(vector<Animation>::iterator ptr = mAnims.begin(); ptr != mAnims.end(); ptr++) {
+               if(*ptr == anim) {
                        mAnims.erase(ptr);
                        return;
                }
        }
 }
 
-void Level::addActor(string name, Actor actor){
+void Level::addActor(string name, Actor actor) {
        mActors.insert(make_pair(name, actor));
 }
 
-void Level::removeActor(string name){
+void Level::removeActor(string name) {
        mActors.erase(name);
 }
 
-Sprite* Level::findSpriteByName(string name){
+Sprite* Level::findSpriteByName(string name) {
        /// \todo make this return a list of all sprites with the same name (or make it specifiable)
-       for(unsigned int i=0; i < mSprites.size(); i++){
+       for(unsigned int i=0; i < mSprites.size(); i++) {
                if(mSprites[i]->getName()==name)//find the sprite with the same name
                        return mSprites[i];
        }
        return NULL;//if a sprite wasn't found return null
 }
 
-Font* Level::getFont( int s = 24, FontType t = English){
+Font* Level::getFont( int s = 24, FontType t = English) {
        map<int, Font*> font = t == English ? mFonts[0] : mFonts[1];
        map<int, Font*>::iterator it = font.find(s);
        //if the font doesn't exist
-       if(it!=font.end()){
+       if(it!=font.end()) {
                //create it
                Font* f = new Font(t,s);
                font[s] = f;
@@ -294,17 +294,17 @@ Font* Level::getFont( int s = 24, FontType t = English){
        }
 }
 
-void Level::closeFont( Font* f){
+void Level::closeFont( Font* f) {
        map<int, Font*> font = f->type == English ? mFonts[0] : mFonts[1];
        map<int, Font*>::iterator it = font.find(f->size);
 
-       if(it != font.end()){
+       if(it != font.end()) {
                //if we're here we have a font
                Font* f = it->second;
                //decrement the count of texts using the font
                f->count--;
                //if there are none left
-               if(f->count==0){
+               if(f->count==0) {
                        //delete it
                        font.erase(it);
                }
diff --git a/Level.h b/Level.h
index ef41000..2e16f34 100644 (file)
--- a/Level.h
+++ b/Level.h
@@ -51,9 +51,9 @@ public:
        void removeAnimation(Animation anim);/**< remove an Actor to the list of sprites  \param anim The actor to add */
        void addActor(string name, Actor actor);/**< add a Actor to the list of sprites \param name Name of the actor \param actor The actor to add */
        void removeActor(string name);/**< remove the Actor sp from the list of sprites \param name Name of the actor to remove */
-       string getName(){ return mName; }/**< returns the current level's name \return Level's name */
-       void setBackground(Background* b){mBackground=b;}/**< sets the current level's background \param b Background */
-       Background* getBackground(){return mBackground;}/**< gets the current level's name \return Level's Background */
+       string getName() { return mName; }/**< returns the current level's name \return Level's name */
+       void setBackground(Background* b) {mBackground=b;}/**< sets the current level's background \param b Background */
+       Background* getBackground() {return mBackground;}/**< gets the current level's name \return Level's Background */
        Sprite* findSpriteByName(string name);/**< returns the first Sprite with a given name \param name Name of the sprite to return \return Pointer to the requested sprite */
        bool Loaded;/**< Shows if the level has loaded or not (level changing) */
        void Unload();/**< What should be done when this level is left (not deleted) */
index 5e78e70..d4d7db6 100644 (file)
@@ -5,7 +5,7 @@
 #include "SDL_ttf.h"
 ///\file LevelFns.h this file should contain all Behaviors for Levels
 
-void LevelWorldLoad(){
+void LevelWorldLoad() {
        Level* l = Game::game()->LoadingLevel;
 
        SDL_Surface* screen = Game::game()->Screen();
@@ -31,7 +31,7 @@ void LevelWorldLoad(){
        sun->setSpeed(1);
 }
 
-void LevelWorldUpdate(){
+void LevelWorldUpdate() {
        Level* LevelWorld = Game::game()->getCurrentLevel();
 
        Sprite* player = LevelWorld->getSprite("viking1");
@@ -39,13 +39,13 @@ void LevelWorldUpdate(){
        Background* bg = LevelWorld->getBackground();
 
        Uint8 *keys = SDL_GetKeyState(NULL);
-       if(player){
+       if(player) {
                if ( keys[SDLK_LEFT] ) { player->xadd(-1); }
                if ( keys[SDLK_RIGHT] ) { player->xadd(1); }
                if ( keys[SDLK_UP] ) { player->yadd(-1); }
                if ( keys[SDLK_DOWN] ) { player->yadd(1); }
        }
-       if(bg){
+       if(bg) {
                if ( keys[SDLK_a] ) { bg->xadd(-1); }
                if ( keys[SDLK_d] ) { bg->xadd(1); }
                if ( keys[SDLK_w] ) { bg->yadd(-1); }
index 71cc8d4..5059b5d 100644 (file)
@@ -4,7 +4,7 @@
 
 ///\file LoadResources.cpp this file should contain implementations for loading resources
 
-void Game::LoadResources(){
+void Game::LoadResources() {
        mLevels.push_back(new Level("World", NeverEnd, LevelWorldLoad, LevelWorldUpdate));
 }
 
index 8b76308..fe843f0 100644 (file)
@@ -45,7 +45,7 @@ void Sprite::draw()
                        mLastUpdate = SDL_GetTicks();
                }
        }
-       if(mVisible == true){
+       if(mVisible == true) {
                glEnable(GL_BLEND);
                glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
                glColor4f(1, 1, 1, mTransparency);
@@ -78,16 +78,16 @@ void Sprite::draw()
        }
 }
 
-void Sprite::update(){
+void Sprite::update() {
        mBehavior();
 }
 
-vector<Collision*>& Sprite::getCollisionData(){
+vector<Collision*>& Sprite::getCollisionData() {
        return mActor.mAnimations[mActor.mCurrentAnimation]->mFrames[mActor.mFrame].collisionData;
 }
 
 
-void Sprite::drawCollisions(){
+void Sprite::drawCollisions() {
        //get the frame for readability
        SpriteFrame frame = mActor.mAnimations[mActor.mCurrentAnimation]->mFrames[mActor.mFrame];
        //center the location
@@ -95,7 +95,7 @@ void Sprite::drawCollisions(){
        WorldObject::drawCollisions(frame.collisionData, pt);
 }
 
-Sprite* Sprite::collisionWithSprite(string name){
+Sprite* Sprite::collisionWithSprite(string name) {
        //get the frame for readability
        SpriteFrame* frame = getAnimation();
        //get the first sprite with this name
index 37f43e6..a7dfac0 100644 (file)
--- a/Sprite.h
+++ b/Sprite.h
@@ -17,13 +17,13 @@ class Sprite : public WorldObject
 {
        public:
        Sprite(std::string name, Actor actor);
-       void setAnimation(int animation){ mActor.mCurrentAnimation = animation; }/**< changes to the specified animation beginning at 0. */
-       SpriteFrame* getAnimation(){ return &mActor.mAnimations[mActor.mCurrentAnimation]->mFrames[mActor.mFrame]; }/**< returns active animation. (actually the current frame within the animation) \todo see if this is slower maybe undo */
+       void setAnimation(int animation) { mActor.mCurrentAnimation = animation; }/**< changes to the specified animation beginning at 0. */
+       SpriteFrame* getAnimation() { return &mActor.mAnimations[mActor.mCurrentAnimation]->mFrames[mActor.mFrame]; }/**< returns active animation. (actually the current frame within the animation) \todo see if this is slower maybe undo */
        void setFrame(int frame) { mActor.mFrame = frame; }/**< cahnges to the specified frame of the animation beginning at 0. */
        int getFrame() { return mActor.mFrame; }/**< returns active frame. */
        void setSpeed(float speed) { mSpeed = speed; }/**< sets the Sprite's speed. */
        float getSpeed() { return mSpeed;}/**< returns a Sprite's current speed. */
-       void toggleAnim(){ mAnimating = !mAnimating; }/**< Pauses or resumes an animation. */
+       void toggleAnim() { mAnimating = !mAnimating; }/**< Pauses or resumes an animation. */
        void startAnim() {mAnimating = 1; }/**< Causes the animation to play. */
        void stopAnim() {mAnimating = 0; }/**< Causes the animation to stop. */
        void rewind() {mActor.mFrame = 0; }/**< Resets the Sprite's animation to the first frame. */
index 6af939c..9ca64b4 100644 (file)
--- a/Text.cpp
+++ b/Text.cpp
@@ -6,15 +6,15 @@
 #include <GL/gl.h>
 using namespace std;
 
-Text::Text(string filename, FontType t, int s, SDL_Color c, int w, int h ) : WorldObject(filename), mFont(Game::game()->getCurrentLevel()->getFont(s, t)), color(c), width(w), height(h){
+Text::Text(string filename, FontType t, int s, SDL_Color c, int w, int h ) : WorldObject(filename), mFont(Game::game()->getCurrentLevel()->getFont(s, t)), color(c), width(w), height(h) {
        
 }
 
-Text::Text(string name, string t, int s, SDL_Color c, int w, int h) : WorldObject(name), text(t), mFont(Game::game()->getCurrentLevel()->getFont(s, (FontType)0)), color(c), width(w), height(h){
+Text::Text(string name, string t, int s, SDL_Color c, int w, int h) : WorldObject(name), text(t), mFont(Game::game()->getCurrentLevel()->getFont(s, (FontType)0)), color(c), width(w), height(h) {
 
 }
 
-Text::~Text(){
+Text::~Text() {
        Game::game()->getCurrentLevel()->closeFont(mFont);
 }
 
@@ -73,5 +73,5 @@ void Text::draw()
        glDeleteTextures(1, &texture);
 }
 
-void Text::update(){
+void Text::update() {
 }
\ No newline at end of file
index f2b9428..86be1a1 100644 (file)
@@ -2,10 +2,10 @@
 #include "fns.h"
 
 
-void WorldObject::drawCollisions(){}
+void WorldObject::drawCollisions() {}
 
-void WorldObject::drawCollisions(vector<Collision*> &vec, const Point2D& pos){
-       for(unsigned int i=0; i < vec.size(); i++){
+void WorldObject::drawCollisions(vector<Collision*> &vec, const Point2D& pos) {
+       for(unsigned int i=0; i < vec.size(); i++) {
                vec[i]->draw(pos);
        }
 }
index b9dbe2a..2ebd9c6 100644 (file)
@@ -25,14 +25,14 @@ public:
        void yset(int y) {mPos.y = y;}/**< Sets the Sprite's y coordinate.  */
        void setPosition(int x, int y) {mPos.x = x; mPos.y = y;}/**< Sets the Sprite's x an y coordinate. */
        Point2D getPosition() { return mPos; }/**< Gets the Sprite's position */
-       void setTransparency(float f){ mTransparency = f>1?1:f<0?0:f;}/**< Sets the Sprite's transparency. \param f The sprite's transparancy [0,1] other values will be force set */
-       float getTransparency(){return mTransparency;}/**< Gets the Sprite's transparency. */
-       void setAngle(float a){ mAngle = a; while(a>360)a-=360;}/**< Sets the Sprite's angle in degrees. \param a Angle in degrees */
-       float getAngle(){return mAngle;}/**< Gets the Sprite's angle. */
+       void setTransparency(float f) { mTransparency = f>1?1:f<0?0:f;}/**< Sets the Sprite's transparency. \param f The sprite's transparancy [0,1] other values will be force set */
+       float getTransparency() {return mTransparency;}/**< Gets the Sprite's transparency. */
+       void setAngle(float a) { mAngle = a; while(a>360)a-=360;}/**< Sets the Sprite's angle in degrees. \param a Angle in degrees */
+       float getAngle() {return mAngle;}/**< Gets the Sprite's angle. */
        void setZOrder(int i) { ZOrder=i; }
        int     getZOrder() { return ZOrder; }
-       std::string getName(){ return mName; }/**< returns the Sprite's name */
-       bool operator<(WorldObject &rhs){ return ZOrder < rhs.getZOrder(); }
+       std::string getName() { return mName; }/**< returns the Sprite's name */
+       bool operator<(WorldObject &rhs) { return ZOrder < rhs.getZOrder(); }
 
 protected:
        std::string mName;/**< Sprite's name */
diff --git a/fns.cpp b/fns.cpp
index ec94784..78464bb 100644 (file)
--- a/fns.cpp
+++ b/fns.cpp
@@ -41,42 +41,42 @@ SDL_Surface* LoadImage( std::string filename )
        return compatible_image;
 }
 
-Point2D::Point2D (const SizeD& copy){
+Point2D::Point2D (const SizeD& copy) {
        x = copy.w; 
        y = copy.h;
 }
 
-double Point2D::length(){
+double Point2D::length() {
        return sqrt(x*x + y*y);
 }
 
-Point2D Point2D::unitVec(){
+Point2D Point2D::unitVec() {
        double len = length();///< \todo optimize
        return Point2D((x/len), (y/len));
 }
 
-Point2D Point2D::add(Point2D pt){
+Point2D Point2D::add(Point2D pt) {
        x += pt.x;
        y += pt.y;
        return *this;
 }
-Point2D Point2D::sub(Point2D pt){
+Point2D Point2D::sub(Point2D pt) {
        x -= pt.x;
        y -= pt.y;
        return *this;
 }
-Point2D Point2D::mult(double d){
+Point2D Point2D::mult(double d) {
        x *= d;
        y *= d;
        return *this;
 }
-Point2D Point2D::div(double d){
+Point2D Point2D::div(double d) {
        x /= d;
        y /= d;
        return *this;
 }
 
-unsigned int nextPow2(unsigned int i){
+unsigned int nextPow2(unsigned int i) {
        i--;
        i |= i>>1;  //handle 2 bit numbers
        i |= i>>2;  //handle 4 bit numbers
diff --git a/fns.h b/fns.h
index 4e3a1fa..57d40f8 100644 (file)
--- a/fns.h
+++ b/fns.h
@@ -10,11 +10,11 @@ using namespace std;
 ///Behaviors use functions that take nothing and return nothing
 typedef void (*Behavior) ();
 ///As the name denotes, this just simply does nothing
-static void DoNothing(){}
+static void DoNothing() {}
 ///A function that determines state of level completion
 typedef bool (*Condition) ();
 ///Condition that is always false
-static bool NeverEnd(){return false;}
+static bool NeverEnd() {return false;}
 ///Texture name
 typedef GLuint Texture;
 ///deg/rad
@@ -38,8 +38,8 @@ class Point2D
 {
        public:
        friend class SizeD;
-       Point2D ():x(0),y(0){}
-       Point2D (double X, double Y):x(X),y(Y){}
+       Point2D ():x(0),y(0) {}
+       Point2D (double X, double Y):x(X),y(Y) {}
        Point2D (const Point2D& copy)///< Copy object 
        {
                x = copy.x; 
@@ -62,8 +62,8 @@ class Point2D
        Point2D div(double d);/**< Divides the values of this by i \return This after modificaiton*/
        Point2D operator+ (const Point2D& pt) const { return Point2D(x + pt.x, y + pt.y); }
        Point2D operator- (const Point2D& pt) const { return Point2D(x - pt.x, y - pt.y); }
-       Point2D operator+= (Point2D& pt){  return add(pt); }
-       Point2D operator-= (Point2D& pt){ return sub(pt); }
+       Point2D operator+= (Point2D& pt) {  return add(pt); }
+       Point2D operator-= (Point2D& pt) { return sub(pt); }
        friend ostream &operator<<(ostream &out, Point2D p)     //output
        {
                out<<"("<<p.x<<","<<p.y<<")";
@@ -76,8 +76,8 @@ class SizeD
 {
        public:
        friend class Pont2D;
-       SizeD ():w(0),h(0){}
-       SizeD (double width, double height):w(width),h(height){}
+       SizeD ():w(0),h(0) {}
+       SizeD (double width, double height):w(width),h(height) {}
        SizeD (const SizeD& copy)
        {
                w = copy.w;