Codesnippets > 2D-snippets

Draw Ellipse / Oval

(1/2) > >>

Kitty Hello:

--- Code: ---DrawOval(100,100,99,33,RGB(255,0,0))
SHOWSCREEN
MOUSEWAIT


FUNCTION DrawOval%: x, y, w, h, col%

INC x, w/2
INC y, h/2

LOCAL phi
STARTPOLY -1, 0
POLYVECTOR x,y, 0,0,col
FOR phi = 0 TO 360 STEP 5 // how poly do you want it?
POLYVECTOR x+COS(phi)*w, y-SIN(phi)*h, 0,0,col
NEXT
ENDPOLY

ENDFUNCTION

--- End code ---
Keywords: draw ellipse, draw oval, drawoval, drawellipse, circle, elipse

Ian Price:
Ah, that's easy Gernot - but an internal function... ;)

Cheers anyway :)

Schranz0r:

--- Quote from: Kitty Hello on 2010-May-04 ---   FOR phi = 0 TO 360 STEP 5 // how poly do you want it?

--- End quote ---

Then you have 361° ?

Kitty Hello:
no. First point is at 0°, last point is at 360°, which is the same as 0° (close the circle)

Schranz0r:
ooops right, my bad :D

Navigation

[0] Message Index

[#] Next page

Go to full version