View Full Version: background always black

C++ Learning Community > C++ Help > background always black


Title: background always black
Description: winbgim problem


Shadow of the Moon - June 30, 2003 01:43 AM (GMT)
After reading Xception's post on the winbgim library, I decided to check it out. I seemed to have hit a snag, though. No matter what I've tried, the background of the window stays black. The other ones work fine. I can work around this problem, but I would like to fix it.

Oh well, here's my code. It's originally based off the one Xception used.

CODE


#define Key_pressed(k) GetAsyncKeyState(k)
#include <winbgim.cpp>
#include <twodplayerclass.h>
#include <twodwallclass.h>



int main()
{
twodplayer player(320, 240);
twodwall wall(16, 16);

initwindow(640,480); //open a 640x480 graphics window  
//////////////////////////////////////////
setbkcolor(WHITE/2);// this doesn't work
//////////////////////////////////////////
setcolor(BLACK);

do // loop
{
setvisualpage(1); // double
setactivepage(0); // buffer
clearviewport(); // clear background

//call events
player.keyboard();
player.draw();
wall.draw();

delay(10); // delay
}  
while(!Key_pressed(VK_ESCAPE)); // until Escape key pressed
 closegraph();        //close graphics window
return 0;
};

Xception - July 1, 2003 02:53 PM (GMT)
Forget that library, I also can't get it to work. Download the Allegro Game library for Dev-C++, it's much more powerful and easy to use.

Shadow of the Moon - July 1, 2003 11:22 PM (GMT)
I was just determined to make it work since I spent three hours trying to get it set up in the first place :P

I've had a bunch of other problems too, so I already scrapped it.
I downloaded Allegro a few days ago. Might take a while for me to get started with it.




* Hosted for free by InvisionFree