What is problem with putimage

This is a discussion on What is problem with putimage within the Game Programming forums, part of the General Programming Boards category; The following code compiles but ball does not move what's the problem? Code: # include<graphics.h> # include<conio.h> # include<alloc.h> int ...

  1. #1
    Registered User planet_abhi's Avatar
    Join Date
    Oct 2002
    Posts
    92

    What is problem with putimage

    The following code compiles but ball does not move what's the problem?
    Code:
    # include<graphics.h>
    # include<conio.h>
    # include<alloc.h>
    int main()
    {
    int gd=DETECT,gm,mx,my,radius,area,x,y;
    char *buff;
    initgraph(&gd,&gm,"");
    mx=getmaxx();
    my=getmaxy();
    radius=4;
    rectangle(0,0,mx,my);
    bar(253,450,317,454);
    setcolor(RED);
    setfillstyle(SOLID_FILL,RED);
    circle(304,404,radius);
    floodfill(304,404,RED);
    area=imagesize(6,6,30,30);
    buff= malloc(area);
    getimage(6,6,30,30,buff);
    x=25;
    y=25;
    while(!kbhit())
    {
    putimage(x,y,buff,XOR_PUT);
    x=x*20;
    y=y*20;
    putimage(x,y,buff,XOR_PUT);
    }
    getch();
    return;
    }
    is any problem with getimage or putimage?
    AbHHinaay

  2. #2
    Registered User planet_abhi's Avatar
    Join Date
    Oct 2002
    Posts
    92
    Now i modify the code but it does not animate!!!
    [code]
    # include<graphics.h>
    # include<conio.h>
    # include<alloc.h>
    # include<dos.h>
    int main()
    {
    int gd=DETECT,gm,mx,my,radius,area,x=304,y=404;
    char *buff;
    initgraph(&gd,&gm,"");
    mx=getmaxx();
    my=getmaxy();
    radius=4;
    rectangle(0,0,mx,my);
    bar(253,450,317,454);
    setcolor(RED);
    setfillstyle(SOLID_FILL,RED);
    circle(304,404,radius);
    floodfill(304,404,RED);
    area=imagesize(280,391,317,419);
    buff= malloc(area);
    getimage(280,391,317,419,buff);
    while(!kbhit())
    {
    putimage(x,y,buff,XOR_PUT);
    delay(5);
    x=x*120;
    y=y*120;
    putimage(x,y,buff,XOR_PUT);
    }
    getch();
    return;
    }
    [\code]
    AbHHinaay

  3. #3
    Registered User planet_abhi's Avatar
    Join Date
    Oct 2002
    Posts
    92
    As per u say i modify it again but it do not work...
    Code:
    # include<graphics.h>
    # include<conio.h>
    # include<alloc.h>
    # include<dos.h>
    int main()
    {
    int gd=DETECT,gm,mx,my,radius,area,x=304,y=404;
    char *buff;
    initgraph(&gd,&gm,"");
    mx=getmaxx();
    my=getmaxy();
    radius=4;
    rectangle(0,0,mx,my);
    bar(253,450,317,454);
    setcolor(RED);
    setfillstyle(SOLID_FILL,RED);
    circle(304,404,radius);
    floodfill(304,404,RED);
    area=imagesize(280,391,317,419);
    buff= malloc(area+sizeof(short)+2);
    getimage(280,391,317,419,buff);
    while(!kbhit())
    {
    putimage(x,y,buff,XOR_PUT);
    delay(5);
    x=x*20;
    y=y*20;
    putimage(x,y,buff,XOR_PUT);
    }
    getch();
    return;
    }
    AbHHinaay

  4. #4
    Registered User planet_abhi's Avatar
    Join Date
    Oct 2002
    Posts
    92
    It doen not animate still...
    Code:
    # include<graphics.h>
    # include<conio.h>
    # include<alloc.h>
    # include<dos.h>
    int main()
    {
    int gd=DETECT,gm,mx,my,radius,area,x=304,y=404;
    char *buff;
    initgraph(&gd,&gm,"");
    mx=getmaxx();
    my=getmaxy();
    radius=4;
    rectangle(0,0,mx,my);
    bar(253,450,317,454);
    setcolor(RED);
    setfillstyle(SOLID_FILL,RED);
    circle(304,404,radius);
    floodfill(304,404,RED);
    area=imagesize(280,391,317,419);
    buff= malloc(area+sizeof(short)*2);
    getimage(280,391,317,419,buff);
    while(!kbhit())
    {
    putimage(x,y,buff,XOR_PUT);
    delay(5);
    x=x+20;
    y=y+20;
    putimage(x,y,buff,XOR_PUT);
    }
    getch();
    return;
    }
    Now i completely stuck...
    AbHHinaay

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 10:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21