1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Question: Turtle Graphics Like Program

Discussion in 'C' started by bhl88, Jul 24, 2006.

  1. bhl88

    bhl88 New Member

    Joined:
    Jul 24, 2006
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    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
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,287
    Likes Received:
    364
    Trophy Points:
    83
    Following code return the scan code of the key hit
    Code:
    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.
     
  3. bhl88

    bhl88 New Member

    Joined:
    Jul 24, 2006
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    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....
     
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,287
    Likes Received:
    364
    Trophy Points:
    83
    Do you mean blinking cursor? Normally the cursor remains at the position you last output anything.
     
  5. bhl88

    bhl88 New Member

    Joined:
    Jul 24, 2006
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    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...
     
  6. bhl88

    bhl88 New Member

    Joined:
    Jul 24, 2006
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    (i dunno how to edit posts)

    DJGPP as compiler
    Language: C

    Question: Same as last post
     

    Attached Files:

  7. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,287
    Likes Received:
    364
    Trophy Points:
    83
    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.
     
  8. bhl88

    bhl88 New Member

    Joined:
    Jul 24, 2006
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    I'm still having problems with my cursor...It is going off in random directions....do you have a code for it?
     

    Attached Files:

Share This Page