Menu

winbgim setbkcolor( )

2005-02-26
2012-09-26
  • Nobody/Anonymous

    OK, sorry. I know this subject been in the forum before - I have problems with the setbkcolor function i winbgim
    The example at http://www.cs.colorado.edu/~main/bgi/doc/setbkcolor.html
    works fine but I can't get setbkcolor() to work in the litle sample program i've downloaded.
    Does anyone see what's wrong
    Source code below:

    include <graphics.h>

    include <conio.h>

    include <math.h>

    include <time.h>

    include <stdlib.h>

    define PI 3.14159265

    void flower(int x, int y, int r)
    {
    int k;
    float x1,y1;
    for(k=0;k<=360;k=k+15)
    {
    x1=rsin(kPI/180.0)+x;
    y1=rcos(kPI/180.0)+y;
    line(x,y,x1,y1);
    }
    }

    int main(void)
    {

    int gd=DETECT,gm,k,x,y,r;
    srand(time(0));
    initwindow(640,480);
    (&gd,&gm,"c:\bc32");

    cleardevice();
    setbkcolor (MAGENTA); //!!!!!!!
    setcolor(YELLOW);

    for(k=1;k&lt;=20;k++)
    {
     x=rand()%640; 
     y=rand()%480; 
     r=rand()%50+20;
     flower(x,y,r);
     delay(500);
    
    }
    

    getch();
    }

     
    • Nobody/Anonymous

      I*ve found out that to get the functions
      cleardevice();
      setbkcolor(3);
      working I have to put them in the function
      void flower()
      why-?
      is it not possible to set the backgroundcolor in the beginning of the program?

       

Log in to post a comment.

MongoDB Logo MongoDB