Moving Objects in Turbo C++

Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Dec 2006
Posts: 24
Reputation: joydsouza90 is an unknown quantity at this point 
Solved Threads: 0
joydsouza90 joydsouza90 is offline Offline
Newbie Poster

Moving Objects in Turbo C++

 
0
  #1
Dec 31st, 2006
How do you make an object, say a rectangle, move in turbo c++, using right and left arrow keys?

I want the object to move when a user presses right or left arrow keys.

Please reply ASAP either here or at my email <<email address snipped>>
Last edited by ~s.o.s~; Dec 31st, 2006 at 9:56 pm. Reason: Email address snipped according to site policy.
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 5,051
Reputation: John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold 
Solved Threads: 332
Team Colleague
John A's Avatar
John A John A is offline Offline
Vampirical Lurker

Re: Moving Objects in Turbo C++

 
0
  #2
Dec 31st, 2006
Use the nonstandard getch() to handle your keyboard input - but beware, it's not supported on all compilers and the input is non-buffered. That being said, there's no C/C++ standard for asynchronous input as far as I know, so using getch() is your best bet.

Using variables to keep track of the object's location, you can then draw it using Turbo's graphics.h file. There's more information about Turbo graphics here:
http://www.onecore.net/turbo-c-graphics-programming.htm

Hope this helps
Last edited by John A; Dec 31st, 2006 at 6:28 pm. Reason: fixed link
"Technological progress is like an axe in the hands of a pathological criminal."

All my posts may be freely redistributed under the terms of the MIT license.
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 24
Reputation: joydsouza90 is an unknown quantity at this point 
Solved Threads: 0
joydsouza90 joydsouza90 is offline Offline
Newbie Poster

Re: Moving Objects in Turbo C++

 
0
  #3
Jan 1st, 2007
hey thanx...but i want to know the exact syntax i need to write to make a rectangle move when a user presses the right or left key. I'm new to Turbo c++ and i would really need all the help i can get.

Thanx a lot
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,266
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: Moving Objects in Turbo C++

 
0
  #4
Jan 1st, 2007
No one will write the exact code for you.

So do some reading and write it yourself.
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 489
Reputation: Bench has a spectacular aura about Bench has a spectacular aura about Bench has a spectacular aura about 
Solved Threads: 49
Bench's Avatar
Bench Bench is offline Offline
Posting Pro in Training

Re: Moving Objects in Turbo C++

 
0
  #5
Jan 1st, 2007
Originally Posted by joydsouza90 View Post
hey thanx...but i want to know the exact syntax i need to write to make a rectangle move when a user presses the right or left key. I'm new to Turbo c++ and i would really need all the help i can get.

Thanx a lot
Start with something a bit more trivial - Learn how to manipulate user input, and how to generate output first. then you'll be one step towards creating a program which combines input/output.

There is no "exact" syntax for doing what you want.. How you accomplish it is entirely up to you, although you need to learn the basics first, then you'll know what options you have available to you.
¿umop apisdn upside down?
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC