Strange error....

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Endar
Posts: 145
Joined: Mon Jun 14, 2004 7:59 am

Strange error....

Post by Endar »

Okay, I'm having some strange problems.
I'm trying to draw a black bar across the top of the screen.

Below is the code in my class that actually draws the bar (or right now, its a box). the function "getCinematicScreenActive()" simply returns a bool value.

drawCinemaScreen:

Code: Select all

drawCinemaScreen(/*pointer to driver*/)
{
     if( getCinematicScreenActive() == true ){
          // Draw black rectangle at the top of the screen
          driver->draw2DRectangle(video::SColor(255,255,255,255),
               core::rect<s32>( core::position2d<s32>(0,0),       core::position2d<s32>(100,100)) );
     }
}
This is the familiar loop. "setCinematicScreenActive()" simply sets a bool value. And, basically, if the value is false, the bar will not be drawn. (the bool variable is initialized to false in the contructor of the "cinema" class)

Code: Select all

while( device->run() ){
     driver->beginScene(true, true, video::SColor(0,100,100,100) );
     smgr->drawAll();

     // Draw the cinema screen
     cinema.setCinematicScreenActive(true);
     cinema.drawCinemaScreen(driver);

     driver->endScene();
}
All the rest of the code is exactly the same as the quake3 map tutorial. So, load map, add FPS camera, etc.

Now, my problem is that whenever I change the parameters for the 'draw2DRectangle' function, I have to setCinematicScreenActive(false) then compile and run the program, then set it to true again.

So, say I draw a black box at (0,0). Then I decide I want it white. So, I change the 'SColor' parameters in 'draw2DRectangle'. Then I compile and run it again. The box will stay black no matter how many times it is compiled until I set the bool value to false with "setCinematicScreenActive(false)", compile and run it again, so no box is drawn and then set the bool value to true using "setCinematicScreenActive(true)" and compile and run it. Then the box will be white.

Ideas??

EDIT: Actually, I found out that when I set to false, I don't have to run it. I can just compile it with false, then compile again with true.
"The reputation of a thousand years may be determined by the conduct of one hour."
-Japanese Proverb
Endar
Posts: 145
Joined: Mon Jun 14, 2004 7:59 am

Post by Endar »

Okay, I found the problem. I had the class in a seperate file and added it with #include. So, when I changed the class file and recompiled, the compiler wouldn't recompile because it didn't notice any changes in the main file.

<frustrated sigh> damn compilers! :D
"The reputation of a thousand years may be determined by the conduct of one hour."
-Japanese Proverb
Post Reply