Thread: Graphic Problem...

  1. #1
    Its not rocket science vasanth's Avatar
    Join Date
    Jan 2002
    Posts
    1,683

    Graphic Problem...

    I am writing a chess game for my school project..(Console game).. i am using BGI graphics, mouse support and bitmapsupport... My game is pretty built now.. the interface, move validation, mouse movments etc.. but the problem is with the image quality.. the images i have stored are very small and is 24bit BMP... they look good on paint.. but not on the console.. Here is a part of my code which reads and displays the image on the screen.... Help me display the image better..

    Code:
    void wking(int sx,int sy) \\sx and sy are the screen position to place image
    {
       char a;
       ifstream ifil;
       ifil.open("C:\\project\\image\\wking.bmp", ios::in); \\image size 40 x 60
       for(int i=0;i<54;i++)ifil.get(a);
       for(i=0;i<60;i++)
         for(int j=0;j<40;j++)
         {
    	ifil.get(a);
    	ifil.get(a);
    	ifil.get(a);
    	int g=a,k;
    	if(a<0)g+=256;
    	k=g/16;
    	setcolor(k);
    	if(a!=0)putpixel(sx+j,sy+200-i,k);
         }
    ifil.close();
    }

  2. #2
    Rambling Man
    Join Date
    Jan 2002
    Posts
    1,050
    I can't tell exactly what's going on, but the problem could be that 'k' isn't getting set to 24 bit color depth, which is what you'll need to at least have if you're bitmaps are 24bit. So try setting the color depth to 24bit (or possibly 32bit) to see if the bitmap quality is better.

  3. #3
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,263
    what doesnt look good about them in the console?
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  2. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  3. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  4. Graphic problem
    By kara in forum Linux Programming
    Replies: 2
    Last Post: 05-28-2006, 07:49 AM
  5. beginner problem
    By The_Nymph in forum C Programming
    Replies: 4
    Last Post: 03-05-2002, 05:46 PM