Author Topic: Gdiplus Circles  (Read 2095 times)

0 Members and 1 Guest are viewing this topic.

Aaron

  • Guest
Gdiplus Circles
« on: March 04, 2014, 04:11:09 AM »
Hello,

More Circles.
Code: [Select]
include "gp.inc"

OpenWindow 800,600,1
fo = LoadFont "arial",14,0
SetSmoothMode 2

kx = GetWidth ()/2
ky = GetHeight()/2
single k=0

While KeyDown(27)=0
    ClsColor &HFFFFFFFF
   
    iF KeyDown(40) then
        k +=1
    Else iF KeyDown(38) then
        k -=1
    End iF
   
    iF k>360 then
       k=0
    Else iF k<0 then
       k=360
    End iF

    DrawCircle kx-200,ky-200,400,2, &HFF000000

    DrawLine kx, ky, kx+200, ky,1, &HFF0000FF
    DrawLine kx, ky, kx+cos(rad(k))*200,ky+sin(rad(k))*200,1,&HFF0000FF
   
    degree = k + "°"
   
    For i=0 To 360 step 2
        SetPixel kx+cos(i)*30,ky+sin(i)*30,0xFF000000
    Next

    DrawText fo,kx+cos(rad(k/2))*60-12/2,ky+sin(rad(k/2))*60-12/2, degree, 0xFF000000
    DrawText fo,10,10, "RADIANS " + str(rad(degree),6),0xFF000000
   
    Sync
    SetFps 24
Wend
CloseWindow

Aaron

  • Guest
Re: Gdiplus Circles
« Reply #1 on: March 04, 2014, 04:12:08 AM »
Code: [Select]
#include "gp.inc"

OpenWindow 640,480,1
font = LoadFont "verdana",18,1

Long i, x, y, h, w
Single a

h = 640/2
w = 480/2
SetSmoothMode SmoothingModeAntiAlias 

while KeyDown(27)=0
  ClsColor ARGB 255,155,0,0
  For i=0, 360, 8
      DrawPoint(w+Sin(Rad(i+a))*60,h+Cos(Rad(i+a))*60,2, &HFFFFFFFF)
      DrawPoint(w+Cos(Rad(i+a))*60,(h-120)+Sin(Rad(i+a))*60,2, &HFFFFFFFF)
      DrawPoint(w+120+Cos(Rad(a-i))*60,h+Sin(Rad(a+i))*60,2, &HFFFFFFFF)
      DrawPoint((w-120)+Sin(Rad(a+i))*60,(h-120)+Cos(Rad(a-i))*60,2, &HFFFFFFFF)
  Next

  a +=1
  If a >=360 Then a =-a

  Sync
wend
CloseWindow

Aaron

  • Guest
Re: Gdiplus Circles
« Reply #2 on: March 04, 2014, 04:13:17 AM »
Code: [Select]
include "gp.inc"
OpenWindow 640,480,1

sys x, y
Single a

SetSmoothMode 2
while KeyDown(27)=0
ClsColor &HFFFFFFFF

for y=0 to <480 step 40
   for x=0 to <640 step 40
      DrawCircle x,y,40,1,&HFF000000
      DrawCircle x+10,y+10,20,1,&HFF000000
      DrawCircle x+15,y+15,10,1,&HFF000000
   next
next

for y=0 to <480 step 40
   for x=0 to <640 step 40
      DrawPoint 20+x+(sin(rad(a)))*20,y+20+cos(rad(a))*20,4, &HFFFF0000
      DrawPoint 20+x+(cos(rad(a)))*20,y+20+sin(rad(a))*20,4, &HFF0000FF
   next
next

a +=2
if a>=360 then a =-a
Redraw
SetFps 200
wend
CloseWindow