Welcome to Phrogram Sign in | Join | Help
in Search


Need help drawing a circle in kpl

Last post 07-25-2008, 11:32 AM by ZMan. 3 replies.
Sort Posts: Previous Next
  •  07-24-2008, 1:58 PM 6924

    Need help drawing a circle in kpl

    Hi guys just started learning programming using kpl and need help to draw a circle, the program needs to draw a circle from an X and Y position given by the user and the user will need to give the size of the circle, apparantly we can use the " circle method " however I have no idea what the circle method is. :(.

     

    We were told to use our rectangle code for this, which we  had to do ourselves and that was easy. Here is the rectangle code, cam anyone give me some pointers as to what i am looking for as 2-3 hours on this and my brain is stumped.

     

     

    // Declare your variables just beneath main(). Variables should be
      // declared with a proper data type and number
      Define lenght As Int
      Define height As Int
      Define area As Decimal
      
      // Move pen to start position
      Pen(False)
      MoveTo(0,0)
      
      // Obtain input from user using console mode

      ShowConsole()
      SetConsoleHeight(150)
      ConsoleWriteLine("Measurements for Rectangle (between 1 and 10 units)")
      Lenght = ConsoleReadline("Enter the lenght of the rectangle: ",True)
      height = ConsoleReadline("Enter the height of the rectangle: ",True)
      area = lenght*height
      
      // Draw rectangle in graphics mode from position (0,0)
      
      Pen(True)
      Color(Blue)
      PenWidth(5)
      MoveTo(lenght*100,0)           // Move to the right
      MoveTo(lenght*100,100*height)  // Move down
      MoveTo(0,100*height)           // Move to the length 
      MoveTo(0,0)                    //Move to the start position
      
      // Set pen to false and return to intial position
      Pen(False)
      MoveTo(0,0)
      
       // Display Area on graphics mode

      MoveTo(0, height*100+5)
      Print("Area: "+ area + " units")
      
      // Display end program in console mode

      ConsoleWriteLine("")
      ConsoleWriteLine("Program Finished")
     

     End Method

     

     

  •  07-24-2008, 2:42 PM 6931 in reply to 6924

    Re: Need help drawing a circle in kpl

    If you look in the help file for Phrogram you will see the description for the Circle method.

    Also if you look in the sample Phrograms you will find several that draw circles that you can draw on for inspiration...

    Seems like this might be some homework so I will refrain from jsut giving you the answer.


    Managed DirectX and XNA ? Check out http://www.thezbuffer.com
  •  07-25-2008, 3:41 AM 6936 in reply to 6931

    Re: Need help drawing a circle in kpl

    kk got the 1st part of the task done, which is to tell the circle where to start

            x = ConsoleReadInt("enter start x: ", True)
            y = ConsoleReadInt("enter start y: ", True)
                   
            Pen(False)
            MoveTo(x,y)

     

     Next part is to draw the circle, now is the commands diff in KPL than PROGRAM ?? as we using kpl

    eg in KPL it looks like its draw and in PROGRAM it likes like its drawto ?/

     

    or using kpl will it be a moveto command to draw a circle?
     

  •  07-25-2008, 11:32 AM 6940 in reply to 6936

    Re: Need help drawing a circle in kpl

    There is a manual for KPL in the help menu. I'm not sure off the top of my head and we have stopped supporting KPL see http://phrogram.com/kpl.aspx

     


    Managed DirectX and XNA ? Check out http://www.thezbuffer.com
View as RSS news feed in XML