Question: Turtle Graphics Like Program

bhl88's Avatar, Join Date: Jul 2006
Light Poster
How do you...

1.) Do a freehand drawing while using number keys:
Ex: 1: NW 2: North 3: NE 4: East...etc...
2.) Go to row or col using arrow keys...
Up down left right
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Following code return the scan code of the key hit
Code: CPP
include <dos.h>
getkey()
{
    union REGS i, o;
    while(!kbhit());
    i.h.ah = 0;
    int86(22,&i,&o);
    return o.h.ah;
}
Now the code can help you to get the Scan code of the required number and then grphics programming can help you draw the object.
0
bhl88's Avatar, Join Date: Jul 2006
Light Poster
How can I move the cursor using the numbers and switch so you can type measurements without moving the cursor. For example...
1: NW 2: North 3: NE 4: East
Pressing the number 1 moves you northwest....then when you type a letter, like s for shape (it will ask for dimensions)...you can type numbers normally again without moving the cursor....

in normal C language....
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Do you mean blinking cursor? Normally the cursor remains at the position you last output anything.
0
bhl88's Avatar, Join Date: Jul 2006
Light Poster
Blinking cursor I guess....moving the part where you type up then when you type s and enter....the direction keys 1-9 now function back as number keys again and you can type the dimensions of whatever shape you like...
0
bhl88's Avatar, Join Date: Jul 2006
Light Poster
(i dunno how to edit posts)

DJGPP as compiler
Language: C

Question: Same as last post
Attached Images
File Type: jpg output.JPG (31.3 KB, 3 views)
Attached Files
File Type: txt Mach Prob.txt (1.4 KB, 9 views)
File Type: txt COLOR PALETTE.txt (223 Bytes, 5 views)
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Enter a line break where you want to place the cursor and then make gotoxy to that location and then print a character or two at the last and the cursor should remain there.
0
bhl88's Avatar, Join Date: Jul 2006
Light Poster
I'm still having problems with my cursor...It is going off in random directions....do you have a code for it?
Attached Images
File Type: jpg PROB.JPG (33.7 KB, 7 views)