Posted: Sat Jun 22, 2002 6:55 pm
Restored from previous forum. Originally posted by Branston.
Hi all.
I'm using the plot command to draw a sine curve in a window.
The curve looks a bit "dotty" despite using increments of 1. Is there any way of joining up the dots?
I think this may be because the plot command only accepts integer values.
Should I be looking at the pen commands in the WINAPI?
Any advice/suggestions welcome. Thanks!
;------------------------ start of progamme------------------------------------
width=800
height=600
p=6.28
rf=255
gf=255
bf=255
rb=0
gb=0
bb=0
screen_height=getsystemmetrics_(#SM_CYSCREEN) ; get users screen settings
screen_width=getsystemmetrics_(#SM_CXSCREEN) ; get users screen settings
; center the screen
posx=screen_width/2-width/2
posy=screen_height/2-height/2
If OpenWindow(0,posx ,posy , width, height, #PB_Window_SystemMenu , "Graph plotter")
EndIf
Gosub drawscreen:
Gosub drawgraph:
Repeat
EventID.l = WaitWindowEvent()
If EventID = #PB_Event_CloseWindow
quit = 1
EndIf
If EventID = #PB_Event_Repaint
Gosub drawscreen:
Gosub drawgraph:
EndIf
Until quit = 1
End
;---------------------------------- subroutines ---------------------------------------
drawscreen:
StartDrawing(WindowOutput())
Box(30, 20,600 , 300 ,RGB(rb,gb,bb))
StopDrawing()
Return
drawgraph:
StartDrawing(WindowOutput())
For x=1 To 600 Step 2
a=a+1
y=(20*Sin(p*a))
Plot(x+30,y+150,RGB(255,255,255))
Next x
FrontColor(255,255,255)
BackColor(rb,gb,bb)
Locate(30,2)
DrawText("Function xyz")
StopDrawing()
Return
Edited by - branston on 22 June 2002 19:58:37
Hi all.
I'm using the plot command to draw a sine curve in a window.
The curve looks a bit "dotty" despite using increments of 1. Is there any way of joining up the dots?
I think this may be because the plot command only accepts integer values.
Should I be looking at the pen commands in the WINAPI?
Any advice/suggestions welcome. Thanks!
;------------------------ start of progamme------------------------------------
width=800
height=600
p=6.28
rf=255
gf=255
bf=255
rb=0
gb=0
bb=0
screen_height=getsystemmetrics_(#SM_CYSCREEN) ; get users screen settings
screen_width=getsystemmetrics_(#SM_CXSCREEN) ; get users screen settings
; center the screen
posx=screen_width/2-width/2
posy=screen_height/2-height/2
If OpenWindow(0,posx ,posy , width, height, #PB_Window_SystemMenu , "Graph plotter")
EndIf
Gosub drawscreen:
Gosub drawgraph:
Repeat
EventID.l = WaitWindowEvent()
If EventID = #PB_Event_CloseWindow
quit = 1
EndIf
If EventID = #PB_Event_Repaint
Gosub drawscreen:
Gosub drawgraph:
EndIf
Until quit = 1
End
;---------------------------------- subroutines ---------------------------------------
drawscreen:
StartDrawing(WindowOutput())
Box(30, 20,600 , 300 ,RGB(rb,gb,bb))
StopDrawing()
Return
drawgraph:
StartDrawing(WindowOutput())
For x=1 To 600 Step 2
a=a+1
y=(20*Sin(p*a))
Plot(x+30,y+150,RGB(255,255,255))
Next x
FrontColor(255,255,255)
BackColor(rb,gb,bb)
Locate(30,2)
DrawText("Function xyz")
StopDrawing()
Return
Edited by - branston on 22 June 2002 19:58:37