If, lets say, you have a person named John Smith, sometimes you can also see the name written Smith, John. Likewise, "the controller" is Controller::the. I got the habit from Java, where you would...
Type: Posts; User: pandu
If, lets say, you have a person named John Smith, sometimes you can also see the name written Smith, John. Likewise, "the controller" is Controller::the. I got the habit from Java, where you would...
Thanks a lot. It's kinda inconsistent and unintuitive...
In the Controller class, I have the following:
static Controller the;
Controller()
{
static Controller the=*this;
}
What? Even without the braces? Never read of it in any tutorial. Lol, so many surprises in this language.
How would you use a forward declaration here? You can't just say "struct BITMAP" like he did, can you?
Thanks. But still, that's such a weird, ambiguous error...
I'm going to include my library.h file then.
Here, I have a class which is intended to be a superclass so that I can put a bunch of its subclasses in a set.
class Drawable
{
public:
virtual void draw(BITMAP* b) =0;
I'm doing this in Allegro (not Allegro3D or OpenGL), which means that I have a fixed-size bitmap. Thusly, I'm forced to check each and every single object to see if (a) it should be drawn on screen...
I'm trying to create a game in which there is going to be a bunch of object in one room, or stage. The objects are going have locations outside the room as well as inside. My player will be at the...
Oh, right, being careless. Would it be easier if I used a function to compare? I guess it wouldn't change too much. Thanks again.
struct circlecomparator
{
bool operator()(Circle* c, Circle* i) //const
{
return c->gsize() >= i->gsize();
}
};
//...
What would be the easiest way to pass in a comparator? I tried the function way, but I couldn't get the syntax right. And then there is the struct way... If possible, can you show me both?
So, I really have no reason to use pointers to objects here? Should I only do it when passing into functions and stuff?
Thanks by the way for that.
Take a look:
set<Circle*>* circles = new set<Circle*>() ;
for(int i=0; i<100; i++)
circles->insert(new Circle(rand()%screen_width, rand()%screen_height ));
set<Circle*>::iterator...