Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 4th, 2006, 1:18 AM   #1
InsaneXterminator
Newbie
 
Join Date: Feb 2006
Posts: 3
Rep Power: 0 InsaneXterminator is on a distinguished road
Move through keyboard

hii all,
i wanted to know the code to move a point or line using the arrow keys of the keyboard. is that possible? i m trying to make the game 'snake'.
plz help. hope u understand wat i m trying to say.
thanx

Last edited by InsaneXterminator; Feb 4th, 2006 at 1:43 AM.
InsaneXterminator is offline   Reply With Quote
Old Feb 4th, 2006, 3:28 AM   #2
ivan
Professional Programmer
 
ivan's Avatar
 
Join Date: Sep 2005
Location: serbia & montenegro
Posts: 484
Rep Power: 3 ivan is on a distinguished road
Depends if it will console or graphical application.
ivan is offline   Reply With Quote
Old Feb 4th, 2006, 5:43 AM   #3
Symptom
Newbie
 
Symptom's Avatar
 
Join Date: Sep 2005
Posts: 28
Rep Power: 0 Symptom is on a distinguished road
If you are using sdl or opengl, they have functions to handle events such as keyboard or mouse input. If you are writing you own app from scratch, you just need to write a funtion that gets one char at a time from stdin and depending on what key was pressed do the appropriate action. Here you can find the keyboard codes for most keys and here there is an application written for a *nix command line that outputs all keyboard input back to the shell. It's not what you want, but this will help you grasp the idea.

Hope this helps...0
__________________
The geeks shall inherit the earth.
Symptom is offline   Reply With Quote
Old Feb 4th, 2006, 6:40 AM   #4
Klarre
Game engine designer
 
Klarre's Avatar
 
Join Date: May 2005
Location: Sweden
Posts: 297
Rep Power: 4 Klarre is on a distinguished road
Quote:
Originally Posted by Symptom
If you are using sdl or opengl, they have functions to handle events such as keyboard or mouse input.
OpenGL does not. I guess you mean GLUT.
Klarre is offline   Reply With Quote
Old Feb 4th, 2006, 11:52 PM   #5
InsaneXterminator
Newbie
 
Join Date: Feb 2006
Posts: 3
Rep Power: 0 InsaneXterminator is on a distinguished road
can u please show me a sample code, i cant really get what u r saying.
InsaneXterminator is offline   Reply With Quote
Old Feb 5th, 2006, 7:28 AM   #6
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Can you understand code written in English, instead of as "u r" doing it?
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Feb 5th, 2006, 7:47 AM   #7
Polyphemus_
Expert Programmer
 
Polyphemus_'s Avatar
 
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 4 Polyphemus_ is on a distinguished road
Quote:
Originally Posted by InsaneXterminator
can u please show me a sample code, i cant really get what u r saying.
That would mean we have to give you for each library we advised an example. You should start by answerring our first question: are you creating it as a console application, or will it be graphical?
Polyphemus_ is offline   Reply With Quote
Old Feb 14th, 2006, 4:53 AM   #8
InsaneXterminator
Newbie
 
Join Date: Feb 2006
Posts: 3
Rep Power: 0 InsaneXterminator is on a distinguished road
i just want a particular character, for eg a * (asterix) to be able to move with the help of the cursor keys on the keyboard.
InsaneXterminator is offline   Reply With Quote
Old Feb 19th, 2006, 8:47 AM   #9
Soulstorm
Hobbyist Programmer
 
Soulstorm's Avatar
 
Join Date: Jan 2006
Location: Menidi, Athens, Greece
Posts: 239
Rep Power: 3 Soulstorm is on a distinguished road
First of all you need to specify what you intend to do.

So, you must tell us if you need instructions about building such a thing as a console application, or using OpenGL.

Finally, what operating system are you using?
__________________
Project::Soulstorm (personal homepage)
Soulstorm is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:33 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC