Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #16  
Old 22-02-2004
Banned Users
 
Join Date: Feb 2004
Posts: 4
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..
Reply With Quote
  #17  
Old 23-02-2004
Member
 
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
Reply With Quote
  #18  
Old 01-03-2004
Banned Users
 
Join Date: Feb 2004
Posts: 4
thanks a lot man! ill try it out sson and keep u posted!
Reply With Quote
  #19  
Old 11-03-2004
Member
 
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.
Reply With Quote
  #20  
Old 11-03-2004
Member
 
Join Date: Mar 2004
Location: Bangalore, India
Posts: 29
hey ferrari, im on DSL i can upload TC fer u.. btw. great pacman code
Reply With Quote
  #21  
Old 12-03-2004
Member
 
Join Date: Dec 2003
Location: 18.55 N and 72.54 E
Posts: 61
Quote:
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
Reply With Quote
  #22  
Old 12-03-2004
Member
 
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
Reply With Quote
  #23  
Old 12-03-2004
Member
 
Join Date: Dec 2003
Location: 18.55 N and 72.54 E
Posts: 61
Quote:
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.
Reply With Quote
  #24  
Old 12-03-2004
Member
 
Join Date: Dec 2003
Location: Goa
Posts: 5
Which version of TC do u want ? I think I have 3.0
Reply With Quote
  #25  
Old 12-03-2004
Member
 
Join Date: Dec 2003
Location: 18.55 N and 72.54 E
Posts: 61
Quote:
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.
Reply With Quote
  #26  
Old 12-03-2004
Member
 
Join Date: Mar 2004
Location: Bangalore, India
Posts: 29
Quote:
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
Reply With Quote
  #27  
Old 13-03-2004
Banned Users
 
Join Date: Feb 2004
Posts: 4
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..
Reply With Quote
  #28  
Old 18-03-2004
Member
 
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.
Reply With Quote
  #29  
Old 19-03-2004
Member
 
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.
Reply With Quote
  #30  
Old 19-03-2004
Member
 
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:\\tc\\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();
}
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Graphics & other programming in Turbo C/C++"
Thread Thread Starter Forum Replies Last Post
Graphics with C programming for Different shapes Adriana_andros Software Development 4 12-01-2010 11:26 AM
Graphics program required in C programming Language ramsun Software Development 3 19-11-2009 12:17 PM
Socket programming: Is any new Programming Language? Kushan Software Development 3 14-11-2009 11:13 AM
JetBrains Introduces a New Programming Paradigm With its Meta Programming System JoeFrat Software Development 3 13-12-2008 01:49 PM


All times are GMT +5.5. The time now is 06:58 PM.