Search found 75 matches
- Tue May 24, 2011 4:20 pm
- Forum: Programming Discussion
- Topic: [SOLVED]Loading a map crashing the game.
- Replies: 2
- Views: 538
Re: Loading a map crashing the game.
SolidTile::SolidTiles.clear(); for (int i = 0; i < SolidTile::SolidTiles.size(); i++) { SolidTile::SolidTiles.at(i) = NULL; } JumpTile::JumpTiles.clear(); for (int i = 0; i < JumpTile::JumpTiles.size(); i++) { JumpTile::JumpTiles.at(i) = NULL; } Entity::Entitys.clear(); for (int i = 0; i < Entity::...
- Thu May 19, 2011 2:57 pm
- Forum: Programming Discussion
- Topic: C/++ Programmers should read this.
- Replies: 5
- Views: 914
Re: C/++ Programmers should read this.
Read/knew most of this before, but it is very helpful.
Thanks for link.
Thanks for link.
- Wed May 18, 2011 5:56 pm
- Forum: Programming Discussion
- Topic: [SOLVED]Deleting Objects
- Replies: 9
- Views: 875
Re: Deleting Objects
Thanks for all the replies! I'd like to clarify that it is a vector of pointers to an Entity class, and that I do check if things aren't NULL before doing things with them, but for some reason when I use delete or call a destructor it still crashes. Now, I think that calling erase is the way I'd li...
- Wed May 18, 2011 4:42 pm
- Forum: Programming Discussion
- Topic: [SOLVED]Deleting Objects
- Replies: 9
- Views: 875
Re: Deleting Objects
Adding to what Ginto said, when you are adding entities to the vector, it's also a good idea to loop through them, and check to see if there's a NULL pointer, if so, assign the value of your entity pointer to that NULL pointer. That way you don't always have to reallocate the vector when you add an...
- Wed May 18, 2011 4:35 pm
- Forum: Programming Discussion
- Topic: [SOLVED]Deleting Objects
- Replies: 9
- Views: 875
Re: Deleting Objects
The vector should be storing pointers to your Entities, and once you delete an entity you should make the pointer to it NULL. Also, in any function that uses your entities you should make sure it's not null before you use it. No, the vector stores what you told it to. vector<class> is defined to be...
- Tue May 17, 2011 2:59 pm
- Forum: Programming Discussion
- Topic: Class Dependency issues (C++)
- Replies: 4
- Views: 713
Re: Class Dependency issues (C++)
It might be from DefaultNPCBehavior.h because you didn't forward declare class NPCBehavior. Also, if you only need pointers in h file, then you can only include in the .cpp like this: bar.h #pragma once class bar { public: int var; bar(); ~bar(); }; (pretend bar.cpp exists and implements everything)...
- Tue May 17, 2011 2:48 pm
- Forum: Game Development
- Topic: Data Structures and Sorting Algorithms
- Replies: 3
- Views: 1515
Re: Data Structures and Sorting Algorithms
Usually when I work on my development, usually I stick to the basic STL things like vectors and hash maps. Do programmers here tend to use other structures like LinkedLists, Queues Every data structure has a purpose, and I have used all of them. My favorite is the stack, but unfortunately STD has a...
- Mon May 16, 2011 4:42 pm
- Forum: Programming Discussion
- Topic: Just wondering about Minecraft
- Replies: 6
- Views: 939
Re: Just wondering about Minecraft
http://notch.tumblr.com/post/3746989361 ... ion-part-1
Some thing to start on.
Some thing to start on.
- Sat May 14, 2011 10:02 pm
- Forum: Programming Discussion
- Topic: Multiple Definition (C++)
- Replies: 6
- Views: 707
Re: Multiple Definition (C++)
It is safe to put it in the cpp, but I generally avoid that too - I prefer to put it in every function that needs it: void function() { using namespace std; //blah blah } This makes copy+pasting easier, and specifically states which functions require the std. If you have inline functions in the .h f...
- Sat May 14, 2011 2:34 pm
- Forum: Programming Discussion
- Topic: Multiple Definition (C++)
- Replies: 6
- Views: 707
Re: Multiple Definition (C++)
#include <SDL/SDL.h> #include <SDL/SDL_image.h> #include <SDL/SDL_ttf.h> #include <iostream> #include <fstream> #include <string> #include "Map.h" #include "Tile.h" using namespace std; #ifndef UTILS_H #define UTILS_H First off, put #includes inside your guards. This will improv...
- Thu May 12, 2011 10:46 pm
- Forum: Programming Discussion
- Topic: Re-visiting my Animation Class [Not Solved]
- Replies: 5
- Views: 684
Re: Re-visiting my Animation Class [Not Solved]
I don't fully understand your question, but here is a quick thing that might be what you're looking for: class AnimationManager { public: struct Animation { unsigned int numFrames; SDL_Rect* frames; }; private: unsigned int animationStackPtr; unsigned int numAnimations; Animation* animations; public...
- Thu May 12, 2011 4:55 pm
- Forum: Programming Discussion
- Topic: Google Code Jam
- Replies: 8
- Views: 1163
Re: Google Code Jam
Qualification round is over.
Who competed?
Who competed?
- Mon Apr 11, 2011 1:16 pm
- Forum: Game Development
- Topic: [School Project] Rendering Engine
- Replies: 22
- Views: 4971
Re: [School Project] Rendering Engine
It says I need d3dx9_43.dll - could you provide it?
Also, no source?![Sad :(](./images/smilies/icon_sad.gif)
Also, no source?
![Sad :(](./images/smilies/icon_sad.gif)
- Mon Apr 04, 2011 7:49 pm
- Forum: General Gaming
- Topic: HIT THA BLOCK with a few bucks, came back with gold
- Replies: 17
- Views: 8994
Re: HIT THA BLOCK with a few bucks, came back with gold
Oh, duh. I meant 60 cents.
- Mon Apr 04, 2011 6:07 pm
- Forum: General Gaming
- Topic: HIT THA BLOCK with a few bucks, came back with gold
- Replies: 17
- Views: 8994
Re: HIT THA BLOCK with a few bucks, came back with gold
If for everytime I hit puberty I got a nickel, I would have 55 cents.