Quest for all from newb
How would I add the arrow keys, the esc key,etc... into my dos programs? I need to know this to make this crap version of a graphics display program...but all in dos based program...
Once again
Icemage
---------------------------------------------------------------
DirectX! Say it with me! DirectX! DirectX! DirectX!
now...
for(times_said=0; times_said < 1000; times_said++)
{
cout <<
}
- DarkMage139
++++++++++++++++
I can do things, things you never knew,
I can change your world if you only knew.
I can do miracles if you want me to.
Anything is possible, I'll prove it to you.
now...
for(times_said=0; times_said < 1000; times_said++)
{
cout <<
"Forget DOS!!!"
;}
- DarkMage139
++++++++++++++++
I can do things, things you never knew,
I can change your world if you only knew.
I can do miracles if you want me to.
Anything is possible, I'll prove it to you.
Yes, but if you learn from the DX7SDK documentation, you need to know what "hammer" means before you understand what a "nail" is, and what a "nail" is before being able to understand "hammer" - then you have to go off on the internet and search for a definition and syntax of this thing called a "board"...it''s all so confusing! So let us newbies start in DOS, get a good foundation, then forget it and do DX, OK? BTW, everything said above and elsewhere by me is merely MHO and doesn''t nessessarily reflect the views of anyone else. TAFN,
Later,
Later
*****************
Is the infinite number of numbers between zero and one any less than the infinite number of numbers between zero and infinity?
*****************
Later,
Later
*****************
Is the infinite number of numbers between zero and one any less than the infinite number of numbers between zero and infinity?
*****************
Yeah, well, I''ll be seeing Icemage at a party later tonight, so I''ll give him a few coding pointers.
- DarkMage139
++++++++++++++++
I can do things, things you never knew,
I can change your world if you only knew.
I can do miracles if you want me to.
Anything is possible, I'll prove it to you.
- DarkMage139
++++++++++++++++
I can do things, things you never knew,
I can change your world if you only knew.
I can do miracles if you want me to.
Anything is possible, I'll prove it to you.
using the arrow keys is simple
you just have to call getch() and see if the ascii values for the arrow keys match
eg:
you should be able to figure out whats what there..
75=left, 77=right
72=up, 80=down
Edited by - Quantum on August 11, 2000 10:31:18 PM
you just have to call getch() and see if the ascii values for the arrow keys match
eg:
char key;if(kbhit()) { key=toupper(getch()); if(key==75) player_x--; if(key==77) player_x++; if(key==72) player_y--; if(key==80) player_y++; }
you should be able to figure out whats what there..
75=left, 77=right
72=up, 80=down
Edited by - Quantum on August 11, 2000 10:31:18 PM
I think Quantum is right.
FYI, there are two main types of keyboard entries. Scan codes, and ASCII codes. ASCII codes are the usual characters you see when you type something. Scan codes are the actual ID of the key you press. Some keys, like the arrows, have no ASCII codes, but still have Scan codes. You need to read these Scan codes to decide what action you should take. As for the Escape key, it has an ASCII code (27, I think).
That''s the part of the theory you should know.
EL
----------------------------------------
"Inash neteia haeg joa kavari quilm..." SD4
FYI, there are two main types of keyboard entries. Scan codes, and ASCII codes. ASCII codes are the usual characters you see when you type something. Scan codes are the actual ID of the key you press. Some keys, like the arrows, have no ASCII codes, but still have Scan codes. You need to read these Scan codes to decide what action you should take. As for the Escape key, it has an ASCII code (27, I think).
That''s the part of the theory you should know.
EL
----------------------------------------
"Inash neteia haeg joa kavari quilm..." SD4
quote:Original post by DarkMage139
DirectX! Say it with me! DirectX! DirectX! DirectX!
now...
for(times_said=0; times_said < 1000; times_said++)
{
cout <<"Forget DOS!!!"
;
}
- DarkMage139
++++++++++++++++
I can do things, things you never knew,
I can change your world if you only knew.
I can do miracles if you want me to.
Anything is possible, I''ll prove it to you.
Yeah, like... DOS IS DEAD man. Learn to live with your grief... I have *sob*
-Chris Bennett ("Insanity" of Dwarfsoft)
Check our site:
http://www.crosswinds.net/~dwarfsoft/
Check out our NPC AI Mailing List :
http://www.egroups.com/group/NPCAI/
made due to popular demand here at GDNet :)
quote:
Later
Yes, but if you learn from the DX7SDK documentation, you need to know what "hammer" means before you understand what a "nail" is, and what a "nail" is before being able to understand "hammer" - then you have to go off on the internet and search for a definition and syntax of this thing called a "board"...it''s all so confusing! So let us newbies start in DOS, get a good foundation, then forget it and do DX, OK? BTW, everything said above and elsewhere by me is merely MHO and doesn''t nessessarily reflect the views of anyone else. TAFN,
You think DirectX is confusing? I started out with DOS. It is confusing as hell. And worst things weren''t documented as well back then.
I loved dos... it was so easy to get simple graphics:
char *ScreenSeg = 0xA000;
((*ScreenSeg)+(y*width)+x) = PixelColour;
or the great old
memcpy(ScreenSeg, MyBlock, sizeof(MyBlock),1);
Where have the good old days gone? *sigh*
-Chris Bennett ("Insanity" of Dwarfsoft)
Check our site:
http://www.crosswinds.net/~dwarfsoft/
Check out our NPC AI Mailing List :
http://www.egroups.com/group/NPCAI/
made due to popular demand here at GDNet :)
char *ScreenSeg = 0xA000;
((*ScreenSeg)+(y*width)+x) = PixelColour;
or the great old
memcpy(ScreenSeg, MyBlock, sizeof(MyBlock),1);
Where have the good old days gone? *sigh*
-Chris Bennett ("Insanity" of Dwarfsoft)
Check our site:
http://www.crosswinds.net/~dwarfsoft/
Check out our NPC AI Mailing List :
http://www.egroups.com/group/NPCAI/
made due to popular demand here at GDNet :)
hey, i've a suggestion for you, Quantum's advice was mostly good, except that for the arrow keys getch() returns 2 codes. What I would suggest is making a little proggy like this to figure out what's what, and go from there (btw, I'm not testing this, so its just a basic concept :
hope this helps and isn't too confusing, if it is lemme know
later,
Edited by - arsenius on August 12, 2000 2:41:09 AM
int a;a = 0;while (a != 27) // i'm pretty sure 27s the code for escape, but don't hold me to it{ a = getch(); cout << a << endl;}[/source] // hey folks, WTF does this not work? it looks right to me, but it doesn't end the source, ACCHH!!!to figure out what escape is do this :cout << getch() << endl;so then what I did to get the proper code was to look at what was outputted when I hit an arrow key (cause I got two things)i put an if statement to do getch() again if I got that first valuelike this:[source]while (a != 27){ if (kbhit()) { a = getch(); if (a = VALUE_RETURNED_BEFORE_ARROW_KEY_I_THINK_ITS_0) a = getch(); // just getch() again to get the real value of an arrow key switch(a) { case(RIGHT): // code break; case (LEFT): // etc. etc..etc... }// end switch }// endif}// end while
hope this helps and isn't too confusing, if it is lemme know
later,
Edited by - arsenius on August 12, 2000 2:41:09 AM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement