Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 35

Thread: Graphics & other programming in Turbo C/C++

  1. #16
    lethal_shrapnel Guest
    thanks a lot guys. the problem is that i am a hosteler in a college. so i cant download or edit any source codes. if it is availaible for immediate viewing i wud love to help out. btw.. i tried working with getimage and putimage before, but they dont seem to work. i think i dunno how to use them at al. do you have to creata a bmp file and then point the function to that file?? and what about the memory parameter?? appreciate it..

  2. #17
    Join Date
    Feb 2004
    Posts
    11
    I've used getimage() and putimage() and its much much faster than putpixel();

    To use putimage, you can't use bmp files and that kind of stuff. It can only display an image saved with getimage(). You can write the memory block saved by getimage() to a file and then print it back using putimage() by reading it into a buffer.

    If you're trying getimage() or putimage() on an empty screen, then obviously you won't notice anything! It's better if you go through the TC++ 3.0 Help's examples.

    If you choose a large area, then the total memory required to save it becomes huge and easily exceeds the program's memory segment or heap. So I wouldn't recommend saving areas greater than 200/200 pixels, even that's quite high. For this reason, both fns use far pointers

    To create a far pointer, use
    void far *buffer;

    To find out the amt. of memory needed to save the area between a region, use imagesize().

    If I'm right, you should allocate the required memory to the pointer by using farmalloc() or new, before using those functions.

    Code:
    size=imagesize(x1, y1, x2, y2);
    void far *buffer=farmalloc(size);
    getimage(x1, y1, x2, y2, buffer);
    ....
    putimage(x1, y1, buffer, COPY_PUT);
    See the TC++ help for more info

  3. #18
    lethal_shrapnel Guest
    thanks a lot man! ill try it out sson and keep u posted!

  4. #19
    Join Date
    Mar 2004
    Location
    Chennai
    Posts
    9
    Hey guys! We all love 2 write programs but how do u make others appreciate it? what i mean 2 say is - if u r not a student of computer science but still have access 2 good libraries and try creating stuff on your own, then aint there any institution which will test ur skills and certify it? i m sure i dont want to join the likes of NIIT or APTECH 4 that matter........just believe on self preparation. i have searched a lot for the same but couldnt find anything satisfying. hope for a feedback from anybody who has tried for an online or written test on the same lines.

  5. #20
    Join Date
    Mar 2004
    Location
    Bangalore, India
    Posts
    29
    hey ferrari, im on DSL i can upload TC fer u.. btw. great pacman code

  6. #21
    Join Date
    Dec 2003
    Location
    18.55 N and 72.54 E
    Posts
    61
    Originally posted by alchemist@Mar 11 2004, 12:15 PM
    hey ferrari, im on DSL i can upload TC fer u.. btw. great pacman code
    hi,
    Thanks, plz. do so

  7. #22
    Join Date
    Mar 2004
    Location
    Bangalore, India
    Posts
    29
    k.. i cant so it rite now cuz ive got xams.. one they're over i will

  8. #23
    Join Date
    Dec 2003
    Location
    18.55 N and 72.54 E
    Posts
    61
    Originally posted by alchemist@Mar 12 2004, 09:44 AM
    k.. i cant so it rite now cuz ive got xams.. one they're over i will
    O Oh a big problem my friend. Don't upload it. It's not free and will violate forum rules. Sandy might reject it.
    Anywayz thanks & all the best for ur exams
    Last edited by ferrari; 12-03-2004 at 11:17 PM.

  9. #24
    Join Date
    Dec 2003
    Location
    Goa
    Posts
    5
    Which version of TC do u want ? I think I have 3.0

  10. #25
    Join Date
    Dec 2003
    Location
    18.55 N and 72.54 E
    Posts
    61
    Originally posted by darshan@Mar 12 2004, 11:17 PM
    Which version of TC do u want ? I think I have 3.0
    Even i have 3.0 darshan. I thought that TA should have a copy so thats why i requested someone1 to upload it since m on dial up. But it's not free.

  11. #26
    Join Date
    Mar 2004
    Location
    Bangalore, India
    Posts
    29
    Originally posted by ferrari

    O Oh a big problem my friend. Don't upload it. It's not free and will violate forum rules
    sandy's that strict??? k.. anyways.. thanx

  12. #27
    lethal_shrapnel Guest
    hey guys i tried out the putimage and getimage thing. its a lot better but the problem remains. now.. i cant seem to putimage a black circle over my pacman.. it just doesnt erase it.. ive tried all combos of the boolean operators XOR, AND etc... it just doesnt work.. plus.. when i use XOR and try to make it move.. it moves smoothly.. but then starts leaving impressions again on the screeen. so my prob remains unsolved how do i make putimage move pacman smoothly completely across the screen. btw.. ferrari can u upload that part of ur pacman code dealing with its generation and movt.?? thanks..

  13. #28
    Join Date
    Mar 2004
    Location
    Chennai
    Posts
    9
    why doesnt anybody go for BLOODSHED DEV C++ 4.0 ? its a freeware and has a GUI. u can also get free updates from its website. the compiler is also quite user-friendly. i find it to b a decent substitute for TC.

    anyway, if any of u wanna try it out, its available on the DIGIT dec. 2003 issues CD called 'encylopedia of technology'. just go to tips-n-tricks>>softwares>>freeware. it also has a JAVA IDE.

  14. #29
    Join Date
    Mar 2004
    Location
    Chennai
    Posts
    9
    Hi guys! Made this program last month ft2:

    The prob is dat it is supposed to reverse the direction of ze ball on hitting the return key. but so far i ve not been able to do it.

    help.

    code pasted below.

  15. #30
    Join Date
    Mar 2004
    Location
    Chennai
    Posts
    9
    #include<conio.h>
    #include<graphics.h>
    #include<alloc.h>
    #include<dos.h>
    void main ()
    {
    int gd=DETECT,gm,area,x=25,y=25,ch,xdirn=1,ydirn=1;
    int maxx,maxy;
    void *buff;

    initgraph (&gd,&gm,"c:&#092;&#092;tc&#092;&#092;bgi");

    setcolor(WHITE);
    setfillstyle(INTERLEAVE_FILL,GREEN);
    circle(50,50,25);
    floodfill(50,50,WHITE);

    area = imagesize (25,25,75,75);
    buff = malloc (area);
    getimage (25,25,75,75,buff);

    maxx=getmaxx();
    maxy=getmaxy();
    rectangle(0,20,maxx,maxy);
    outtextxy(250,10,"ANIMATION");

    while (1)
    {
    if (kbhit())
    {
    ch=getch();
    /* if ENTER is hit reverse the direction of movement */
    if (ch=='/r')
    {
    xdirn*=-1;
    ydirn*=-1;
    }
    else
    {
    if (ch==27)
    break;
    }
    }

    putimage (x,y,buff,XOR_PUT);
    delay (0);
    x=x+(xdirn*1);
    y=y+(ydirn*1);
    putimage (x,y,buff,XOR_PUT);

    /* check if ball touches horizontal boundaries */
    if (x>maxx-50x<0)

    {
    sound(500);
    delay(50);
    nosound();
    xdirn*=-1;
    }

    /* check if ball touches vertical boundaries */
    if (y>maxy-50y<20)

    {
    sound(500);
    delay(50);
    nosound();
    ydirn*=-1;
    }
    }

    getch();
    closegraph();
    restorecrtmode();
    }

Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. Graphics with C programming for Different shapes
    By Adriana_andros in forum Software Development
    Replies: 4
    Last Post: 12-01-2010, 11:26 AM
  2. Graphics program required in C programming Language
    By ramsun in forum Software Development
    Replies: 3
    Last Post: 19-11-2009, 12:17 PM
  3. Socket programming: Is any new Programming Language?
    By Kushan in forum Software Development
    Replies: 3
    Last Post: 14-11-2009, 11:13 AM
  4. Replies: 3
    Last Post: 13-12-2008, 01:49 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,575,014.66234 seconds with 17 queries